2
votes

I got this error when I changed my index.php file into index.html file and then changed back again to its original index.php file

Can anyone tell me what to do to prevent this error?

Warning: session_start() [function.session-start]: open(/tmp/sess_e0725de9954b..2c14904, O_RDWR) failed: Permission denied (13) in /home/accn/public_html/dbc.php on line 42

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/accn/public_html/dbc.php:42) in /home/acceptin/public_html/dbc.php on line 42

2
Please post your code. This description is essentially useless without it. :-( - Matt
Is /tmp full? Use the df /tmp command to find out. - Sjoerd
The answer's in the error: permission denied. You need your webserver to be allowed to write to /tmp if that's where you're storing sessions. - jeremyharris
do you have anything like html tag above your session_start();, remove it if there is. - Kalpesh
@Sjoerd where can I find /tmp ? Im new to this thing, I'm beginner for programming - Jam Ville

2 Answers

19
votes

Create folder "tmp" on your root directory with permission 777 then before start_session,

ini_set('session.save_path', 'tmp');

Done

0
votes

when using ini_set be sure to set the path '/tmp' rather than just 'tmp' didn't work in my case 'tmp'. just like

ini_set('session.save_path', '/tmp')

Steps to solution

  1. create folder tmp inside of the website root

  2. change permission to 777

    sudo chmod -R 777 tmp

  3. enter this line above session_start() in your code

    ini_set('session.save_path', '/tmp');

done.