3

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

6
  • 1
    Please post your code. This description is essentially useless without it. :-(
    – Matt
    Commented Aug 2, 2012 at 14:43
  • Is /tmp full? Use the df /tmp command to find out.
    – Sjoerd
    Commented Aug 2, 2012 at 14:44
  • 3
    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. Commented Aug 2, 2012 at 14:47
  • do you have anything like html tag above your session_start();, remove it if there is.
    – Kalpesh
    Commented Aug 2, 2012 at 14:48
  • @Sjoerd where can I find /tmp ? Im new to this thing, I'm beginner for programming
    – Sam San
    Commented Aug 2, 2012 at 14:49

2 Answers 2

20

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

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

Done

3
  • for me it worked when I put this folder inside www, not root folder.
    – kaha
    Commented May 29, 2013 at 21:42
  • 1
    Simply creating the folder with permission 777 was enough in my case (actually permission 700 worked). Thanks.
    – Pamela
    Commented Mar 26, 2015 at 15:05
  • Thanks! I was facing the same problem and your solution just fixed it.
    – mtchuente
    Commented Jan 12, 2016 at 12:22
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.