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
PHP Glob - Scan in Subfolders For a File
How to Disable Output Buffering in PHP
Sanitizing Strings to Make Them Url and Filename Safe
Warning: Domdocument::Loadhtml(): Htmlparseentityref: Expecting ';' in Entity,
PHP Array Merge Two Arrays on Same Key
PHP - How to Best Determine If the Current Invocation Is from Cli or Web Server
Persistent/Keepalive Http With the PHP Curl Library
PHP Getting Domain Name from Subdomain
Gcm Notifications Not Receiving When App Is in Background Mode in Ios
How to Change Maximum Number of Post Variable in PHP
How to Validate Google Recaptcha V3 on Server Side
Pdo With "Where... In" Queries
Can't Access Global Variable Inside Function
PHP, MySQL Error: Column Count Doesn't Match Value Count At Row 1