Running phpMyAdmin with APC cache enabled, fatal PHP errors

If you run phpMyAdmin in combination with PHP's APC caching module, you might find your phpMyAdmin returning blank white pages instead of the actual management interface. In your errors logs, you can see messages like this.

PHP Fatal error:  Class 'PMA_Error_Handler' not found in /path/to/phpMyAdmin/libraries/common.inc.php on line 58
PHP Fatal error:  Call to undefined function PMA_getenv() in /path/to/phpMyAdmin/libraries/common.inc.php on line 143

The solution is to exclude phpMyAdmin from the APC cache, which you can do with a following parameter in your Virtual Host configuration.

<Directory /path/my/phpMyAdmin/>
php_admin_value apc.enabled 0
</Directory>

Update the path above to the correct directory where phpMyAdmin resides, and restart your Apache to activate the config.

If the above does not fix it, you can also try to clear your PHP sessions, which are known to cause issues with phpMyAdmin. Especially if your php.ini is lacking explicit "session.save_path" declarations (by default they point to /tmp).

session.save_path = "/tmp"

Good luck!

The Social Box

You can sign up for more updates via Twitter or Facebook below. On Twitter, I regularly talk about technology or tweet about interesting stories. Topics that don't necessarily make it to this blog. Facebook contains a steady update of blogposts and some more lightweight stories.


Write a Comment

Do you care about the markup if your comment? You can use the following HTML tags:

<code>command</code>: command highlighting
<pre>text</pre>: pre-formatted code, can be multi-line (black background, white letters)

example <pre> tag
<blockquote>text</blockquote> quoted text
quoted example


None of this is needed of course, it's all optional!

Comment

*

  1. Another fix, as recommended by phpMyAdmin, is to use the “apc.filters” option in php.ini:

    If you have weird random problems also check out whether apc or eaccelerator is the culprit. If the problem is with APC it’s possible to prevent scripts in the phpMyAdmin directory from being cached with apc.filters. For instance you can add something like this to your php.ini: apc.filters = “-/usr/share/phpmyadmin/.*”

  2. Same with me this morning. It’s too slow when using phpmyadmin and it throw error. Yesterday i installed APC and i think apc is the cause of error. Thanks for your advice.

  3. Someone might benefit from this;

    if you use virtual hosts and have apc installed, your virtual hosts might not work anymore. I needed APC to run a joomla site wich i had under a virtual host. (on Macos Snow Leopard).

    The solution for me was
    1) installing APC (find some tutorial about that)
    2) Modify php.ini and include ‘extension=apc.so’
    3) In the bottom include this:

    [APC]
    apc.enabled = 1
    apc.shm_segments = 1
    apc.shm_size = 32M
    apc.optimization = 0
    apc.num_files_hint = 512

    4) To prevent the problem with virtual hosts i changed apc.enabled = 0 (then restart apache). So actually use this:
    [APC]
    apc.enabled = 0
    apc.shm_segments = 1
    apc.shm_size = 32M
    apc.optimization = 0
    apc.num_files_hint = 512

    and restart apache.

    Works for me.

  4. Matti, THANK YOU. This issue was driving me crazy and consumed eight hours of my life. You were fortunate to have errors in your PHP logs; I had none (despite error-reporting being set to -1 [E_ALL]). Disabling APC for the phpMyAdmin directory, per your suggested solution, resolved the issue for me.

  5. hello. how are you guys doing.
    I really need help on this one. I believe I’ve the same problem. Whenever I wanna go to phpmyadmin on my localhost, i will get this error –
    Fatal error: Call to undefined function PMA_cacheExists() in C:\wamp\apps\phpmyadmin3.5.1\libraries\database_interface.lib.php on line 1237

    I’m able to access phpmyadmin panel when i first install wamp. Now, my wordpress site is complete and I wanna transfer them to my hosting, so I have to go to phpmyadmin to export my db right…but i cant.. :(
    Can anyone please help me.
    Thank you :(

    -Zaza