Apcu is not enabled when installed with apt-get on PHP7.2-apache stretch image

15.7k views Asked by At

I installed php-apcu with apt-get install on PHP7.2-apache-stretch but not able to enable it. The apcu.so and apcu.ini files are created during installation . Service Apache is also restarted and the content of apcu.ini is also good but php -m is not showing apcu in the list. Had also tried phpenmod but still it doesn't seem to work. However I am not getting any error during installation . The problem seems to be related to image because i had also tried to install apcu in the same way on fresh Debian image and it's working.

Any ideas please?

2

There are 2 answers

0
Aviator On

Install PHP7.2-dev via apt install PHP7.2-dev and thereafter run pecl install apcu and add the extension to the php.ini.

4
Graham S. On

Just posting an answer here in case someone else has the same problem I did trying to execute PHPUnit tests...

I was trying to run some automated feature tests that use APCu and could not for the life of me figure out why apcu_enabled() was always returning false on my local machine. I had installed everything correctly via pecl install apcu and added the extension=apcu.so entry to my php.ini file, etc. phpinfo also showed the extension was enabled properly.

Turns out that I needed to add apc.enable_cli=1 to my php.ini file so that APCu would work with CLI commands. I hope this saves you the 5 days of your life that I will never get back.