How to fix Call to undefined function apc_fetch() – PHP Fatal Error [Solved]

Updated on September 1, 2017

I have been migrating one of the Joomla website and was stuck with a “PHP fatal error Uncaught Error: Call to undefined function apc_fetch()”. If you are stuck with a similar error, then here’s how you can solve it. Before that, below is the snapshot of the error:

Fatal error: Uncaught Error: Call to undefined function apc_fetch() in /var/www/libraries/joomla/cache/storage/apc.php:35 Stack trace: #0 /var/www/libraries/joomla/cache/cache.php(188): JCacheStorageApc->get('ab82b3238b14dcb...', 'Gantry', true) #1 /var/www/libraries/joomla/cache/controller.php(179): JCache->get('ab82b3238b14dcb...', 'Gantry') #2 /var/www/libraries/gantry/core/utilities/cache/joomlaCacheDriver.class.php(40): JCacheController->get('ab82b3238b14dcb...', 'Gantry') #3 /var/www/libraries/gantry/core/utilities/cache/cache.class.php(135): JoomlaCacheDriver->exists('Gantry', 'ab82b3238b14dcb...') #4 /var/www/libraries/gantry/core/utilities/gantrycache.class.php(240): GantryCacheLib->get('Gantry', 'ab82b3238b14dcb...') #5 /var/www/libraries/gantry/gantry.php(269): GantryCache->addWatchFile('/var/www/cfw_pr...') #6 /var/www/libraries/gantry/gantry.php(432): gantry_setup() #7 /var/www/templates/rt_cla in /var/www/libraries/joomla/cache/storage/apc.php on line 35

How to fix PHP Fatal Error – Call to undefined function apc_fetch()?

Solution: Looking at the error, it is clear that the application is expecting PHP APC module to be enabled.

There are two ways to solve it:

Undefined function apc_fetch


Option 1: Install PHP APC module using the below command:

#apt-get install php7.0-apc

Then restart the web server

#/etc/init.d/apache2 restart

Option 2: If you don’t want APC to be used for caching, then just disable it. Open configuration.php file and search for the below line:

public $cache_handler = 'apc';

And replace it with:

public $cache_handler = 'file';

In this way Joomla will be use file as the cache handler instead of APC.

Voila, Joomla works great now!

Was this article helpful?

Related Articles

Comments Leave a Comment

  1. so you either use apc with php7 or you don’t use it at all. nice one

Leave a Comment