Error: session_start(): open(SESSION_FILE, O_RDWR) failed: Permission denied (13) while accessing PHPMyAdmin

 

Hi Friends,

Today, I have come across an unknown issue while accessing PHPMyAdmin. I was getting below error:

—–
Error during session start; please check your PHP and/or webserver log file and configure your PHP installation properly. Also ensure that cookies are enabled in your browser.

session_start(): open(SESSION_FILE, O_RDWR) failed: Permission denied (13)
—–

I have also uploaded the screenshot of the error message below for clear understanding.

 

 

Reason:

Usually this error occurs when the permission or ownership of the tmp folder for the user is incorrect. Refer the below attached image.

 

 

You can see that the ownership of the tmp folder is correct, however the permission is incorrect. As we know in Linux, the folder should have 755 permission and file should have 644 permission. I will explain about permission and ownership in separate post. In above image, the permission of tmp is 644, however it should be 755.

You must be thinking that what is the big deal in this post. Anyone can guess that the tmp folder has incorrect permission. Yes you are right. The main purpose of writing this post is even if we know the permission of tmp folder is incorrect, who will guess the issue will be with the tmp folder, if we are not able to access PHPMyAdmin. Moreover, PHPMyAdmin is giving strange error as well. That is why, I thought of sharing this with you. Now coming to solution.

 

Resolution:

Make sure the ownership of /home/$username/tmp folder has ownership set to $user and permission as 755. If it is not, you will face the same error.

Change the permission of tmp folder to 755 in this case. This will fix the issue. Steps is given below for your convenience.

1. Login to server via SSH.

2. Check the permission and ownership of /home/$user/tmp folder. Set ownership as $user. Execute the below command:

chown $user. /home/$user/tmp

3. Set permission of the tmp folder to 755.

chmod 755 /home/$user/tmp

Note: In the latest version of cPanel, you might not face the above issue, when the ownership is different from $user. But you will face issue if the permission is not set to 755.

Hope you will love this post. If you have any query/doubt, feel free to post in the comment section given below.

Thank you.

Powered by Facebook Comments

2 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.