简体   繁体   中英

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

I am getting the error:

Warning: Unknown: open(/tmp/sess_beaac196b5082a77131f957bcfa35ee7, O_RDWR) failed: Permission denied (13) in Unknown on line 0

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

I have checked the /tmp directory and it is writable (using this code):

$filename = '/tmp';
if (is_writable($filename)) {
    echo 'The file is writable';
} else {
    echo 'The file is not writable';
}

The php.ini file says session.save_path is /tmp

Is there something obvious I'm missing?

EDIT: I have tried setting a new session path but even after CHMOD 777 it gives me a tells me:

Warning: session_start(): open(/sessions/sess_beaac196b5082a77131f957bcfa35ee7, O_RDWR) failed: No such file or directory (2) 

use session_save_path() on page starting

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

I eventually managed to get it working by putting the full path of my new folder in..

session_save_path('/home/scittwebhost/sessions');

I still do not know why I couldn't write to /tmp - the permissions were 777

Thanks all

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM