Php session variables null

I’ve got two sites - development and production - both residing on the same server, both running php 4.4.4

My session variables are coming up null on the dev site, but work properly on the prod site.

The scripts are the same on both sites, except that I added echo statements to the scripts on the dev site to determine that the session variabels were null.

the last time something like this happened was in Jan/Feb and it may or may not have been related to DH upgrading to php 4.4.2.

Or, it may have had something to do with not using cookies:

At herod’s suggestion, I changed the line from

ini_set (‘session.use_cookies’, 0);


ini_set (‘session.use_cookies’, 1);

from my login script, and sessions started working again.

However, since both sites are running 4.4.4, and both are running the same login script, there’s got to be something else going on.


(edited to reflect the proper ini_set line)

If you call phpinfo on both sites, do you see any differences?


Assuming I did this correctly, no.

$ cat cool*/phpinfo.php


Welcome to the Center for Content-free Hospitality




$ php > c.out
$ php > h.out
$ diff h.out

< [0] =>

[quote][0] =>


It probably doesn’t matter, but the dev site (the one not working) is

It should be called from a web browser, or even wget. Doing it from local php doesn’t use Apache’s mod_php. Create two files (one for each site), one called site1.php and site2.php that contain the following:

<?php echo phpinfo(); echo "\n"; ?>

Then, from the command line:
wget > site1.txt
wget > site2.txt
diff site1.txt site2.txt


argh. Sorry for a stupid question, but wget is getting a 403 forbidden on both sites. The phpinfo.php page is (and was) in the root directory on both sites and is accessible from the browser.

I’m not denying it in my .htaccess, and am not seeing anything in the error log

fyi, I had run that on both sites from my browser before posting this issue. Having seen both sites come up with php 4.4.4, and this for the System:

Linux yoda 2.4.29-grsec+w+fhs6b+gr0501+nfs+a32+++p4+sata+c4+gr2b-v6.189 #1 SMP Mon Feb 7 13:23:30 PST 2005 i686

I didn’t look any further manually

A wget works for me, but at least it shows up in the browser. That’ll be harder to check line by line for any differences.

You could try disabling .htaccess for a few seconds while you try a wget.


Don’t know why that worked, but I should have thought of it myself.

Anyway… looks like different versions of Apache:

dev site:

SERVER_SOFTWARE Apache/2.0.54 (Unix) PHP/4.4.2 mod_ssl/2.0.54 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.1.4


SERVER_SOFTWARE Apache/1.3.37 (Unix) mod_throttle/3.1.2 DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/ PHP/4.4.4 mod_ssl/2.8.22 OpenSSL/0.9.7e

and different servers





They’re both on yoda, but something’s different. Check your settings in Manage Domains to see if perhaps one has Extra Web Security and/or FastCGI Support turned on while the other doesn’t.


Is your production site one set up way back when before DreamHost did some upgrades? Old sites retain old server configs (PHP as Apache vs. User, Apache 1 vs 2) while new sites get the latest and greatest.


The prod site had extra security, the dev site did not. I changed that so that they both do, with no change in the problem. FastCGI is not and was not set up for either site.

The dev site was set up in 12/2004, the prod site in 11/2005.

Is there a way for me to change server configs, specifically to make my dev site match the prod site?

You’ll most likely not be able to get dev to match prod, but you can always see if Support will do it.

It’s easier to get prod to look like dev since dev is newer, but then it’d be broken until you fix it. Best bet is to get dev to work since it’s the latest and greatest in DreamHost configs.