phpMyAdmin "Cannot start session without errors"
Posted October 22nd, 2008 in PHP
Yesterday one of my customers reported their phpMyAdmin install was showing the error message "Cannot start session without errors" and they were unable to even get to the phpMyAdmin login page. This post looks at what caused the issue and how to fix it.
The error message in question looks like this:
phpMyAdmin - Error
Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.
Clearly there's something wrong with the way sessions are being used. I checked the Apache error log file and it didn't actually show any error messages and I don't have PHP logging errors separately.
The next step was to have a look at the php.ini file and see what the session settings are. This is on a CentOS 5 webserver with a default install. I've removed all the unecessary comments etc:
[Session] session.save_handler = files session.save_path = "/var/lib/php/session" session.use_cookies = 1 session.name = PHPSESSID session.auto_start = 0 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 1000 session.gc_maxlifetime = 1440 session.bug_compat_42 = 0 session.bug_compat_warn = 1 session.referer_check = session.entropy_length = 0 session.entropy_file = session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 session.hash_function = 0 session.hash_bits_per_character = 5
I couldn't see anything wrong there, so I figured the next logical step was to check the directory specified by the session.save_path option as follows:
ls -l /var/lib/php total 2 drwxrwx--- 2 root apache 2048 Jul 17 11:56 session
That shows us that the session directory is owned by "root", the user is "apache" and it can be written to by both user and group but no one else. That all looks fine but we run this particular webserver as a user other than "apache".
It would therefore appear that when I did an upgrade of PHP a little while back it restored the user permissions back to root:apache instead of leaving them root:myusername (myusername isn't the actual username in question - just an example). I am making an assumption here because there shouldn't be any other reason for the permissions to have changed.
A simple chown is all that's required:
sudo chown -R root:myusername /var/lib/php/session
and then the error in phpMyAdmin went away and we were able to log in again.
So, assuming I am correct that a PHP upgrade on CentOS restored the PHP session directory default permissions, if you run Apache on CentOS as a user other than "apache" you need to make sure you check the permissions of your PHP session directory after upgrading. This will affect any websites using PHP file based sessions, not just phpMyAdmin.
Related posts:
- Fix the mbstring PHP extension not found error in phpMyAdmin (Thursday, September 18th 2008)
- phpMyAdmin "operation could take a long time" message (Wednesday, June 4th 2008)
- phpMyAdmin (Wednesday, December 10th 2003)
Recent posts:
- MySQL queries for article summaries part 2 of 2 (Tuesday, January 6th 2009)
- Aims for 2009 (Monday, January 5th 2009)
- Weekly Roundup - January 5th 2008 (Monday, January 5th 2009)
- MySQL queries for article summaries part 1 of 2 (Sunday, January 4th 2009)
- 2008 Summary of Posts (Saturday, January 3rd 2009)
- 2008 / 2009 overview (Friday, January 2nd 2009)
Subscribe to RSS Feed / Email / Bookmark / Share
Use the buttons below to subscribe to my RSS feed to be notified next time something is posted, share this post with others, or subscribe by email and have my posts sent in a daily email.
Posts are made using the following schedule (although it may vary some weeks): Mondays & Fridays = PHP; Tuesdays & Saturdays = MySQL; Wednesdays & Sundays = Javascript/jQuery; Thursdays = HTML/CSS.
