How to Fix the Permission Error When I Call Session_Start()

How can I fix the Permission error when I call session_start()?

Change session path where you can write data or contact server administrator about /tmp problem

http://php.net/manual/en/function.session-save-path.php

PHP Warning Permission denied (13) on session_start()

You don't appear to have write permission to the /tmp directory on your server. This is a bit weird, but you can work around it. Before the call to session_start() put in a call to session_save_path() and give it the name of a directory writable by the server. Details are here.

Warning: session_start(): failed: Permission denied (13)

use session_save_path() on page starting

refer : http://php.net/manual/en/function.session-save-path.php

session_start() failed: Permission denied (13)

chmod -R o+w ...../temp or even better (safer) chown -R apache.apache ......./temp (replace apache with the user/groupname your webserver is using).

php session_start: failed: Permission denied (13)

The path in session_save_path('/w/w/session'); is not the one you need.

Try one of those:

session_save_path('./session');
session_save_path('/session');
session_save_path('/tmp');

On a shared host, you are not as flexible as on a rootserver, and your /www is chrooted, that means, the real path, which you cannot access then is something like /var/www/user3183123/www.

PHP: session error

It seems you are encountering a permissions violation in the /tmp/ dir. Make sure php has write access to the directory. If you cannot change the permissions for any reason, look at this documentation on changing your session save path:

http://php.net/manual/en/function.session-save-path.php

session_start() not working on mac

You need to change the permissions on:

/var/folders

I would suggest changing the ownership of the folder:

sudo chown -R nobody /var/lib/php/session
sudo chgrp -R nobody /var/lib/php/session

The 'nobody' option being the user that your webserver runs under and for the second command it's the group.

Note: The folder would need to be changed to wherever you have set your session.save_path to. In the question above the folder is /var/folders so the code would be chown -R nobody /var/folders



Related Topics



Leave a reply



Submit