PHP session.save_path problem

How to resolve PHP session.save_path problem

It has taken me a whole morning and a lot of stress to fix this problem with my server’s PHP configuration, so I have documented here step-by-step exactly what I did in the hope that I can help others who are experiencing similar problems.

First of all, check your server settings to find out if this is your problem.

In Notepad, paste the following text and save it as an “all files” type called phpinfo.php:

<?php phpinfo(); ?>

Then use the FTP facility to upload this file to the root directory on your server.  On mine this was the default location so I didn’t have to fiddle.

Once uploaded, point your browser to this file by typing in the address “www.yoursite.com/phpinfo.php” substituting yoursite.com with your own domain.

Scroll down to the “Session” section and look at the session.save_path.  If it says “No value set” then you have the same problem I had and this is for you :)

Open a fresh page on Notepad and copy and paste into it the following text:

session.save_path = "/tmp"

Now In a new tab on your browser, log in to your hosting settings and find the details of your server, where your IP address, OS/Hosting type, PHP version, etc, are displayed.  (On mine this is all together in one section).  There you should see Absolute Hosting Path  displayed beginning with /home/content…….  Copy the /home/content….. string and toggle back to Notepad.  Delete the /tmp bit by pasting in the /home/content…. string between the ” ” instead.

Save this Notepad document as an “all files” type with the name php5.ini  then upload this via FTP to your root directory.

Point your browser once again at “www.yoursite.com/phpinfo.php” and check the session.save_path to make sure that this has worked.  It should now be set to the value of your Absolute Hosting Path.

Problem solved! :D

A bit more…

It may also be useful to note that this php5.ini file we have just created acts as an amendment to the master php.ini file, which can be viewed on your server by creating a Notepad file with the following text:

<? system("cat /web/conf/php5.ini"); ?>

Save this as an “all files” type called showme.php and upload it to your root directory, the same as you did with the phpinfo file.  As before, use your browser to view this by typing in the address “www.yoursite.com/showme.php”

 

12 thoughts on “PHP session.save_path problem

  1. For information……setting the sesion.save_path in the php.ini in the manner described will work for a site hosted with anyone, not only one hosted with GoDaddy.

  2. Question: if WordPress is not installed in the root of your site, how would you change these instructions (if at all)?

    This is my case. I followed your instructions, and the session.save_path has not been updated.

    Thanks!

    • Hi Kevin, thanks for commenting. I’m not sure I can help though as I’m no guru, I developed these instructions by piecing together the scattered information I could find with a bit of intuition until it worked. Hopefully someone who knows more about it will see this and help out.

  3. Worked like a charm! I’ve been trying to solve this sudden error for hours, tried anything you can think of, including ssh, killing sessions, creating new folders and pointing, investigating bugs etc etc.. the only thing that confused me was, i tried to rename the current php.ini file as php5.ini, so there was no php.ini file left. but when i read your blog again, i left it as is, and cretated a new php5.ini and uploaded, and voila! THANK YOU! :)

  4. Thank you so much… this cured my problem…

    It needs to be said that when you add the path to session.save_path = “/tmp” , it should not have the quotes around the path.

    It should read session.save_path = /tmp and just replace /tmp.

    THanks again…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>