How to Fix Joomla’s Problem With session.save_path

We have previously examined a problem where one of our clients was not able to login to the administrator’s control panel, and we have concluded that the root of the problem is that PHP was unable to write the session information to the filesystem because it doesn’t have the proper permissions.

This problem often happens at an even larger scale when a new Joomla website is installed on a new server. The person installing Joomla will see something like “PHP is trying to open a file (that looks like a session file) but is unable to write to the file”. Obviously, installation cannot continue and the user is stuck.

Some try to solve this problem by doing one of the following:

1- Edit the php.ini file and change the session.save_path value to a directory that exists and that Apache (or IIS) has permissions to write to and read from.
2- Create a different php.ini file and install it under the root directory of the website (this way it will be loaded when the website will be launched).
3- Change the permission of the session directory that php.ini is trying to write to.

We think that both 3 solutions are inefficient, here’s why:

– For solution #1, you must have root access to the whole server in order to do this, and since many Joomla website owners don’t have this privilege, we should forget about this solution.

– For solution #2, you must have the right version of php.ini in order to install under your root directory, because if you don’t, then you may fix the session problem, but you may break almost everything else. And we don’t know of many hosting companies that will give the php.ini file to any of their users, so you will need to guess all the information based on php_info(); (which is really hard). Solution #2 is probably the most complicated.

– Now if you’re trying to implement solution #3, it means that there’s a 99.99% chance that you can’t implement it. Why? Because if you don’t have access to the original php.ini file, then it means you don’t have permissions to the session write directory specified in php.ini.

So how can this problem be fixed?

It’s very easy, you just do the following:

Step 1 – Login (through FTP) to your website and create a directory called cache and you it the right permissions.
Step 2 – Get the physical path of your website.
Step 3 – Add the function session_write_path($cache_directory); to the beginning of your index file ($cache_directory is the physical location of your cache direcotry that you created in step #1).

Problem solved!

We can help you solve the problem in no time. We will charge you for an hour, or $75 for a guaranteed fix according to our excellent rates! All you need to do is contact us!

2 Responses to “How to Fix Joomla’s Problem With session.save_path”
  1. Comment by Cynthia — April 1, 2012 @ 2:40 pm

    There’s already a cache directory in the package, there’s no need to create one.

    It’s not clear in which index.php the function should be inserted, but I’ve tried with the root and with the one in installation folder, and this solution you suggested just not work.

  2. Comment by Fadi — April 3, 2012 @ 7:35 pm

    Hi Cynthia,

    make sure that the variable $cache_directory exists. So you should have something like this:

    $cache_directory = ‘/home/yourjoomlawebsite/public_html/cache’;

    Make sure that $cache_directory points to the absolute path of your directory you created called cache. Also make sure you give 666 as permissions to that directory.

Leave a comment