Where Can I Find "apc.enable_cli"?

I would like to set up memory caching and find that I need to set " `apc.enable_cli " to 1 in php.ini. First, there are more than one php.ini files in my system, which one should I modify? (…7.3/fpm/php.ini or …7.3/cli/php.ini) Second, after searching through the two files, I cannot find any lines that contain “apc.enable_cli=1”, should I add it to the two files? Thanks.

1 Like

Hi,

Be sure you have installed apcu module for php. You can uncomment/add these lines in your php.ini or php.d/apcu.ini for example:

extension=apcu.so
apc.enabled=1
2 Likes

Thanks…

I have this in my apc.ini:

extension=apcu.so
apc.enabled=1
apc.shm_size=32M
apc.ttl=7200
apc.enable_cli=1
3 Likes

For enabling ‘apc.enable_cli’ in php.ini do below steps: (ubuntu + LAMP)
a. sudo apt install php7.4-cli php7.4-common php-apcu
1- if your server runs PHP-FPM
2- try to find php.ini for instance (/etc/php/7.4/fpm/php.ini)
3- we have to add { apc.enable_cli } line inside php.ini file
4- if your server runs Apache PHP module then
try to find for instance( /etc/php/7.4/apache2/php.ini)
5- sudo systemctl reload apache2
6- sudo systemctl restart php7.4-fpm
for more information read below article:

7- it’s done!

1 Like

In my installation with 7.4 fpm I had to add it to the php.ini in the cli folder (i.e. /etc/php/7.4/cli/php.ini), if you run php from the cli, for example for the cron jobs of nextcloud.

And check always what version a pure php invoke at the command line will give you by executing php -v. I had an installation with php 8.1 in the apache config, but cli was using php 8.2! Normally there is a soft link to the used version for /usr/bin/php