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

10,361

Solution 1

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

Solution 2

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 api.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.

Share:
10,361
DepGr
Author by

DepGr

Updated on August 27, 2022

Comments

  • DepGr
    DepGr over 1 year

    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?

  • Gianni Genovesi
    Gianni Genovesi over 2 years
    after spending 30 minutes debugging on this, i found this answer and totally make the day (maybe even five of them) Thank you a lot