Warning session_start() open() failed: Permission

software development


I see a lot of questions about this error and no answers that worked as well as this one!

Just a note before I go on… If you have a difficult issue that you have overcome… POST THE SOLUTION for all of us to see! Nothing is worse than searching through a bunch of posts where nothing is resolved because people don’t post the information on how they fixed it. Take the time to post useful help for everyone’s benefit.


If you are getting something like this error:
Warning: session_start(): open(/tmp/sess_9ace3e42e3eb00c3ec5df76045e395fd,
O_RDWR) failed: Permission denied

Looks like php is having permission issues trying to write a session value to the session directory, so you first need to make sure you have the correct permissions to write to the session directory normally /tmp. You can try this by simply running session_start(); from a new file you create called test.php page. If you get that error chances are you don’t have permissions and the sys admin should be able to correct that for you.

The issue I had was that my script was using “ForceType” where I could dynamically creative pages on the fly. This caused the same error message and nothing the sys admin could do helped, so I think it has something to do with creating php files dynamically using ForceType.

Here is the work around without getting support from the system admin:

  1. Create your own temporary directory like:

  2. chmod it 0777.

  3. Then add a .htaccess file to your web sites main directory and add this line:

php_value session.save_path /home/youraccount/yourwebsite.com/sesstmp

That should do it! It worked for me, and I searched for a solution everywhere!


urbanroute (at) gmail (dat) com


It’s sort of funny that you posted this, I have been beating my head against the wall for a couple of weeks now trying to figure out why my site was dropping sessions.

I was setting the ssl url dynamically because I’m using the same code on multiple sites. What I found out was that going from http://www.mysite.com to http://mysite.com will cause the session to drop. I’m not positive that will fix the issue, but I’m pretty sure.

Does anyone else have any experience with this? It really sucks cause my ssl cert was for http://mysite.com, not http://www.mysite.com.

Angela Gann
CrimsonDryad Web Design Services
Web Design, Custom Software Development


In case someone is looking for an alternate method, you can try something like this in your PHP…

  • Create a folder (ex: session) and change the permission to 777 as mentioned above
  • add the following line of code (pointed to the correct location and folder name):

You’ll need to have that code on every page which uses the session.