Removing PHPSESSID

software development

#1

Hi,
Have read other posts and besides installing PHP for myself (groan) I can’t find a way to remove this in my search engine results.

The PHPSESSID is generated as Google-bot crawls over several sites I did with shopping carts installed. The carts use cookies and won’t work without them enabled. But Google-bot doesn’t use cookies and so PHP (on DreamHost servers) adds the PHPSESSID automatically. DreamHost help said my only fix was to do my own PHP installation and make change to .ini file.

Has anyone found a way around this?


#2

try this before your session_start() call:

ini_set(‘session.use_trans_sid’, 0);

when i was running my site on the php4 apache module, i did that through .htaccess with this line:

php_value session.use_trans_sid 0

now that i’m on php5 cgi though it’s off by default, so i’m surprised you’re seeing PHPSESSID show up at all.

track7 - my dream-hosted site


#3

Ah Ha!

You are fabulous. I checked the phpinfo() and sure enough, the shopping cart that doesn’t have the PHPSESSID has 5.5.2 with:

session.use_trans_sid set to 0

while the shopping cart that does have the PHPSESSID has 4.4.7 with:

session.use_trans_sid set to “On”

Oh man, this is great news. This means that the DreamHost support guy made an error in a)not asking me which version of PHP I was having the issue with, and b)he might also be wrong in telling me that the method you’re suggesting won’t work (when the PHP manual seems to indicate it would work)

Which method would work on 4.4.7 on CGI - the .htaccess or using ini_set(‘session.use_trans_sid’, 0); ?


#4

you’d need to use ini_set() in php code, since php running as cgi won’t see the php_value settings in .htaccess.

have you considered moving to php5 for the better default settings?

track7 - my dream-hosted site


#5

Ok, got it!

Yes, after reading your posts, I am considering moving these clients to php5…I’m not entirely sure what differences it might cause (there are online stores set up) so I will probably just try the ini_set() first. But the next time I set up a new client, I’ll make sure to start out with php5, lesson learned.

DreamHost keeps telling me that ini_set() will not work, but I’m going to run a test when I get back from vacation and see if it does work and eliminate the issue. Do you have any idea why DreamHost keeps telling me ini_set() won’t work?

Really, really appreciate the help!


#6

some values can’t be controlled through ini_set (like if they need to be set before the script actually starts running), so maybe this is one of them. it’s worth a try though!

in general, scripts written for php 4 still work in php 5, but there are a few differences and also different php.ini settings.

track7 - my dream-hosted site


#7

The solution, for DreamHost, was to upgrade to PHP 5, where the session id was OFF by default. Problem solved.