PDA

View Full Version : not sure I understand php sessions



llclj
08-30-2008, 10:54 AM
EDITED TO ADD: Before sending this I added a php.ini file to my public_html directory and changed the session path to /home/sitename/tmp where sitename is the username listed in my cpanel. Since this didn't help I wondered what I am missing.
**********************

so maybe this isn't exactly an advanced scripting question but here goes.

I have a wordpress plugin that suddenly quit working. It is a shopping cart plugin and when you press "add to cart" nothing happens.

I did some research on the plugin website and the consensus seems to be that the issue is with php sessions going nowhere. Another user said the issue was a quick cpanel fix, contact your ISP, but he did not elaborate and I don't know where to look.

I have been on live chat here twice but no results so hoping someone here might be able to shed a light. Or even a pinprick at this point would be helpful.

I have done a bit of php programming but never messed with the php.ini file. Where exactly do I need a php.ini file? If I modify php.ini to save sessions to a certain directory - where should this directory be? Is it even necessary to specify the directory? If I have 3-4 sites hosted with bluehost, do I need multiple php.ini files or just one in public_html?

About a month ago I enabled fastcgi. Is that what caused my problem and I just didn't notice it until now? (because I have been travelling)

(here is the full story and what I have tried, sorry for the length but hopefully detail helps)

The person I was chatting with at bluehost suggested the problem is a) plugin incompatibility and/or b) the plugin not working with wordpress 2.6. (I had added a new plugin.)

I think s/he completely ignored my question about php sessions going nowhere.

He asked me to re-upload the plugin. (perhaps a better action would have been to deactivate the new plugin but anyway...). He seemed to indicate that he added a php.ini file to my site and that would solve my problem (after re-uploading didn't). Actually what he did was to run a script that added a php.ini file to EVERY directory on my site. EVERY ONE.

This did not solve the problem. After adding all of the php.ini files and re-uploading the plugin, I could not access the site at all. I was getting a fatal php error that I can't remember now.

(the plugin has worked fine with the current configuration. i.e. not previously needed these files in every directory)

He then renamed the plugin directory. I could access the site so he left me to figure out my pluign problem - again ignoring the php sessions question. So...

I got rid of most of the php.ini files, successfully re-activated the plugin, could now access the site but original problem still there.

I contacted live chat again.

This guy says the php.ini files don't hurt anything and since they exist there CANNOT be a php sessions issue. He says the problem is that when I "add to cart" a google analytics call is made that never finishes. I delete the google analytics code from the site but.... problem still happens. (and the google code suddenly quit working?)

so now I am at a loss.

If in fact the problem is php sessions going nowhere, how do I fix this?

Thanks for your time,
Lori

felgall
08-30-2008, 03:32 PM
It sounds like the support person has done everything that would be needed to fix a session going nowhere problem so the cause of the problem must be something else.

Try disabling all your plugins and see if that fixes it. If so then it is one of the plugins that is causing the problem.

llclj
08-30-2008, 04:45 PM
Thanks, I had already disabled all the plugins except for this one. I also switched to the default wordpress theme, again, no luck.

Is it necessary to have a php.ini file in EVERY directory?

After doing some more reading - I only have one - my public_html directory - and I have specified the session path as - /home/sitename/tmp. Is this correct? Is there something else I need to do to verify the php sessions are being accessed ok?

This process was working and quit working while I was on holiday. Another reason I am perplexed, I had not made any changes recently.

Thanks
Lori

felgall
08-30-2008, 06:25 PM
If you have FastCGI enabled then you only need a php.ini in the public_html folder. If you don't have it enabled then you need it in every folder where you want to override the system defaults.

If something was working before and has now stopped working then perhaps one of the files has become damaged. Try replacing the files and see if that helps.

zemil
09-01-2008, 03:31 AM
Hi Lori

"Is there something else I need to do to verify the php sessions are being accessed ok?"

Just to verify this, you can try to insert a

echo "SESSID: ".session_id();
after your includes / before any output to browser. (that is in your <?php ?> )
This will write the SESSID on top of your page.

"This guy (the friendly bluehost staff) says the php.ini files don't hurt anything, and since they exist there CANNOT be a php sessions issue. "
- meaning that since the SESSIONs exist... or the php.ini's ?


Perhaps the NEW plugin you added had a $_SESSION variable by the same name as the CART plugin you use(d). this could perhaps be a problem. dunno.

A tip for when asking for help, tell the release version, and the plugin names. perhaps even your site name. (cant hurt SEO to have som links around ;) )

"...on the plugin website and the consensus"
You make it sound like its a general problem more ppl have?

griffinmt
09-02-2008, 08:01 PM
Since you indicated that you had made anther change (Fastcgi) then I would suggest disabling it temporarily and then retest. I have had it cause me a few irritating problems and now run without it, your mileage may vary.

Also, check your access and error logs for any indications of failure.