Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

APCu and Symfony2

Tags:

php

symfony

apc

Since PHP 5.5 broke APC in favor of their own cache, I'm trying to get my Symfony2 project running with APCu instead, and it doesn't like it:

$ php app/console cache:clear --env=prod --no-warmup
PHP Fatal error:  Call to undefined function Doctrine\Common\Cache\apc_fetch() in /home/maf/symfony/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php on line 40

The documentation of APCu is basically non-existent, and the Symfony2 docs are outdated, providing help only for APC.

I regret using PHP these days with all the compatibility-breaking upgrades, but I need to get my project running again. Where do I apply the gaffer tape?

like image 349
Tom Avatar asked Jan 11 '14 10:01

Tom


People also ask

Why Use APCu?

This adapter is a high-performance, shared memory cache. It can significantly increase an application's performance, as its cache contents are stored in shared memory, a component appreciably faster than many others, such as the filesystem.

What is APCu cache?

APCu is a user-accessible PHP cache. Pantheon provides APCu by default across all plans, but the size of the APCu memory cache (apc. shm_size) varies depending on the service level. See the Application Containers overview to learn more about APCu on Pantheon's container architecture.


1 Answers

You should make sure that you have APC support emulated, so make sure that you have extension=apcu.so (version >= 4.0) in your php.ini.

APC support emulated on PHP 5.5

like image 154
Anton Babenko Avatar answered Oct 07 '22 19:10

Anton Babenko