How To Fix Error: “Warning: session_start() [function.session-start]: open(/path/to/file, O_RDWR) failed: Permission denied (13) in /path/to/script.php on line __LINE__”

3 Comments

I recently had this error. There was lots of information on the internet, but nothing that could help me with my specific case. It would appear that a session file is not accessible anymore and this is causing the error. Aside from the error itself, I was only seeing this error on one particular browser on one particular computer and could not replicate anywhere else.

The fix I found was to remove the session file at the location defined in open(/path/to/file, O_RDWR). To do this you need to SSH into your server. If you don’t have access to your server via SSH then you should probably submit a support ticket with your hosting company explaining which file you need removed and they’ll be able to do this for you.

Open terminal (or equivalent, I’m on a Mac) and SSH to your web server:

$ ssh username@server.com

And just remove the file. You could use sudo rm but you’re probably better off just renaming the file incase you need it again.

$ sudo mv /path/to/file /path/to/file.backup

This should clear up the error for you. I hope this helps someone else.

  • Kirk

    Thanks for this, this worked perfectly. I noticed however that on my server at least the sess file in question belonged to a different user (website) than what the error was for.

    So the error was on a site owned by web1 but the file was owned by web2. When deleting the file if you go to web1 first, there is no error, but on web2 there is. It looks like both sites are sharing the same sess_ file. I have changed the permissions for this file to 666 which removes the error but I assume this is going to cause issues in the long run?

  • http://ampleindsol.com/ Dilbag Koundal

    Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home/content/03/10280303/html/wp-content/plugins/calpress-pro/calpress-pro.php:325) in/home/content/03/10280303/html/wp-content/plugins/wp-fontsize/wp_fontsize.php on line 23

    what to do with this???

  • http://www.facebook.com/daaiyah.naim Daa’iyah Na’im

    Thanks!!! This worked like a charm!

Twitter