tags:

views:

116

answers:

4

I am having a problem with sessions on my server. Is this a server problem or a coding problem? I get this error message:

Warning: Unknown: Failed to write session data (files). 
Please verify that the current setting of session.save_path 
is correct (/var/php_sessions) in Unknown on line 0
+2  A: 

the error message is pretty clear.
PHP cannot write session data into /var/php_sessions directory.
Change this setting to default value

Col. Shrapnel
+3  A: 

Most likely either the directory /var/php_sessions does not exist or the php process doesn't have write permissions for it.

What does

$path = '/var/php_sessions';
foreach( array('file_exists', 'is_dir', 'is_readable', 'is_writeable') as $fn ) {
  $rc = $fn($path);
  echo $fn, ': ', $rc ? 'true' : 'false', "<br />\n";
}

print?

VolkerK
A: 

Why dont you view you php.ini, and verify the session_path, and check if the directory in it exists in your local folder

Starx
A: 

If you have two sites that you are working on on the same server, that could be your issue. For example, I would run into this issue when developing two separate sites on the same shared host.

Site A:

http://sharedaddress.com/~sitea

Site B:

http://sharedaddress.com/~siteb

The problem is that the sessions would be stored based on the permissions for sharedaddress.com, and not the site I was working on. When I would switch over to the new site, it would be unable to access the session variables, and I would get the permissions error mentioned above.

To solve this issue, I would use the IP address to go there directly (since typically the site was not live yet).

Joseph