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!

Looking for help?

Tired of fixing all these tech-problems yourself? We've got an excellent team at Nucleus, a top-class Belgian hosting provider, that can help you. Discover our Managed Hosting, where skilled engineers manage your servers and keep them up-to-date, so you can focus on your core business. We use a variety of Configuration Management Systems such as Puppet to make sure every config is reviewed, unit-tested and guaranteed to be working.

Want to get in touch? Find me as @mattiasgeniar on Twitter or via the contact-page on my blog.

Tagged with: ,
Posted in php
8 comments on “Running phpMyAdmin with APC cache enabled, fatal PHP errors
  1. Apocalypskmaw says:

    Thanks for sharing Matti !
    You made my day !

  2. Eric Caron says:

    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/.*”

  3. Tuan says:

    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.

  4. anonymous says:

    How can i do this on Windows IIS?

  5. Dirk-Jan de Groot says:

    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.

  6. Ben says:

    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.

  7. Thank you for sharing this info. After googling for 5 hours you saved my day :)
    Thank you VERY much

  8. zaza says:

    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

2 Pings/Trackbacks for "Running phpMyAdmin with APC cache enabled, fatal PHP errors"
  1. [...] On some systems you want APC to work for a few Virtual Hosts, but not all – as it may break things like phpMyAdmin. [...]

  2. […] 参考:Running phpMyAdmin with APC cache enabled, fatal PHP errors […]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>