Access Denied Unable to establish a PHP session. If you believe that this is in error or inadvertent, contact your system administrator and ask them to review your server settings.
That was the error seen on a phpmyadmin installation on one of my customer servers. It’s related to the phpMyAdmin sessions, which need to be written inside the /tmp directory to work properly.
What causes Access Denied Unable to establish a PHP session PHPMyAdmin error?
This phpmyadmin error is caused usually by wrong file or directory permissions, as well as wrong owner on the /tmp files at this path:
/home/$username/tmp
I’ve also seen this error on the general /tmp directory of some plain CentOS servers.
How can I fix it?
For cPanel or DirectAdmin users
Just make sure the directory has the user ownership, you can set the right owner for this file by running:
chown username.username /home/$username/tmp
And let’s make sure the permissions are set to 755, run this command:
chmod 755 /home/$username/tmp
For plain Linux servers (without control panel)
chmod 1777 /tmp
That’s all, your phpmyadmin error should be totally fixed now.
Using permissions of 777 is never a good idea or recommendation. Instead, you should suggest adjusting permissions accordingly to the requirements. There is never need to have permissions more open than 775 at most…
I agree about 777 is insecure, however, if you check the guide you will notice it is 1777, not 777.
1 before 777 means only the owner of the file (root in this case) can modify the directory or file (in this case, the /tmp partition).