Php session variables null


#1

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:

http://discussion.dreamhost.com/showthreaded.pl?Cat=&Board=forum_troubleshooting&Number=38086&page=&view=&sb=&o=&vc=1#Post38086

At herod’s suggestion, I changed the line from

ini_set (‘session.use_cookies’, 0);

to

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.

Anybody?

(edited to reflect the proper ini_set line)


#2

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

Terry


#3

Assuming I did this correctly, no.

$ cat cool*/phpinfo.php

Greetings

Welcome to the Center for Content-free Hospitality

<?php

phpinfo();

?>

$ php coolgeek.dreamhosters.com/phpinfo.php > c.out
$ php honestargument.com/phpinfo.php > h.out
$ diff h.out

412c412
< [0] => coolgeek.dreamhosters.com/phpinfo.php

[quote][0] => honestargument.com/phpinfo.php

[/quote]

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


#4

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 http://www.site1.com/site1.php > site1.txt
wget http://www.site2.com/site2.php > site2.txt
diff site1.txt site2.txt

-Scott


#5

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


#6

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.

-Scott


#7

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

prod:

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

and different servers

dev:

REMOTE_ADDR 208.97.133.244

prod:

REMOTE_ADDR 64.111.114.137


#8

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.

-or-

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.

-Scott


#9

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?


#10

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.

-Scott