Symfony 3 / APCu + PHP7

user3703456 picture user3703456 · Jun 29, 2016 · Viewed 7.3k times · Source

I have a problem with APCu and PHP7 again. Here is my conf.

framework:
    validation:
        cache: validator.mapping.cache.doctrine.apc
    serializer:
        cache: serializer.mapping.cache.apc

doctrine:
    orm:
        metadata_cache_driver: apcu
        result_cache_driver: apcu
        query_cache_driver: apcu

Website works ok, but when I send a form, I always get this error:

[2016-06-29 09:17:12] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\UndefinedFunctionException: "Attempted to call function "apc_fetch" from namespace "Doctrine\Common\Cache"." at ROUTE_TO_PROJECT/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php line 41 {"exception":"[object] (Symfony\Component\Debug\Exception\UndefinedFunctionException(code: 0): Attempted to call function \"apc_fetch\" from namespace \"Doctrine\Common\Cache\". at ROUTE_TO_PROJECT/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php:41)"} []

here is my composer:

"require": {
    "php": ">=5.5.9",
    "symfony/symfony": "3.0.*",
    "doctrine/orm": "^2.5",
    "doctrine/doctrine-bundle": "^1.6",
    "doctrine/doctrine-cache-bundle": "^1.2",
    "symfony/swiftmailer-bundle": "^2.3",
    "symfony/monolog-bundle": "^2.8",
    "sensio/distribution-bundle": "^5.0",
    "sensio/framework-extra-bundle": "^3.0.2",
    "incenteev/composer-parameter-handler": "^2.0",
    "knplabs/knp-paginator-bundle": "^2.5",
    "liip/imagine-bundle": "^1.5",
    "jms/serializer-bundle": "^1.1",
    "symfony/assetic-bundle": "^2.8",
    "gopay/payments-sdk-php": "^1.1",
    "knplabs/knp-snappy-bundle": "~1.4",
    "friendsofsymfony/user-bundle": "~2.0@dev"

Why is Symfony call apc_fetch instead apcu_fatch?

Answer

Joe Watkins picture Joe Watkins · Jul 2, 2016

In previous versions of APCu, the APC module and functions were provided as part of the library.

In the most recent (PHP 7) versions of APCu, backward compatible APC is a separate extension.