Symfony 2 - Attempting to call the apcu_fetch function from the Doctrine \ Common \ Cache namespace

I am using PHP7.0.8 and the doctrine cache (with APCU) in my symfony project. When I call a function from my controllers that use this cache, there is no problem, it works great!

But when I create a batch file that uses a repository that uses the doctrine cache, and when I run this command in my shell, I have an error:

[Symfony \ Component \ Debug \ Exception \ UndefinedFunctionException]
  Attempted to call the apcu_fetch function from the "Doctrine \ Common \ Cache" namespace.

My configuration:

doctrine:
dbal:
    driver:   pdo_mysql
    host:     "%database_host%"
    port:     "%database_port%"
    dbname:   "%database_name%"
    user:     "%database_user%"
    password: "%database_password%"
    charset:  UTF8
orm:
    auto_generate_proxy_classes: "%kernel.debug%"
    entity_managers:
        default:
            auto_mapping: true
            mappings:
                StofDoctrineExtensionsBundle: ~
            metadata_cache_driver: apcu
            query_cache_driver: apcu
            result_cache_driver: apcu

The same code works if I run it in the controller :( I think this is a mistake, any idea?

+4
2

, AND, php-apcu ubuntu.

sudo apt-get install -y php-apcu

:

sudo phpenmod apcu

, php-apcu php config.

php -i | grep apcu

- :

/etc/php/7.0/cli/conf.d/20-apcu.ini,
apcu

, apcu .

+5

php , php-cli ( ), php. Php php-cli , , . php-cli.

+2

Source: https://habr.com/ru/post/1651883/


All Articles