0

I have several php version. And I need install apcu and apc for both php version. I installed

pecl install apcu
pecl install apcu_bc-beta

and after this in /usr/lib/php/20170718/ have apcu.so and apc.so And I added /etc/php/7.2/mods-available/apcu.ini with this content

extension=apcu.so
extension=apc.so
apc.enabled=1
apc.shm_size=256M
apc.ttl=7200
apc.enable_cli=1
apc.gc_ttl=3600
apc.entries_hint=4096
apc.slam_defense=1
apc.serializer=php

and when I have been enable php 7.2 evrything worked fine. I see apc in phpinfo - apache and in php cli in console

but then I added the same ini file in php 7.1 and have error when run php -m

PHP Warning: PHP Startup: Unable to load dynamic library /usr/lib/php/20160303/apcu.so' - /usr/lib/php/20160303/apcu.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/apc.so' - /usr/lib/php/20160303/apc.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP 7.1.18-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Jun 11 2018 14:23:29) ( NTS )

and it's true in /usr/lib/php/20160303 I don't have apc and apce so files. Because I have this both files in /usr/lib/php/20170718/

I changed /etc/php/7.1/mods-available/apcu.ini to

extension=/usr/lib/php/20170718/apcu.so
extension=/usr/lib/php/20170718/apc.so
apc.enabled=1
apc.shm_size=256M
apc.ttl=7200
apc.enable_cli=1
apc.gc_ttl=3600
apc.entries_hint=4096
apc.slam_defense=1
apc.serializer=php   

and have error

PHP Warning: PHP Startup: apcu: Unable to initialize module Module compiled with module API=20170718 PHP compiled with module API=20160303 These options need to match in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20170718/apc.so' - /usr/lib/php/20170718/apc.so: undefined symbol: zif_apcu_store in Unknown on line 0 PHP 7.1.18-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Jun 11 2018 14:23:29) ( NTS )

could somebody help me enable apcu and apc for php 7.1 ?

shuba.ivan
  • 3,824
  • 8
  • 49
  • 121

1 Answers1

3

I solved this issue like this approach

sudo apt-get install php7.1-apcu -y

and after that I saw apc and apcu so files in /usr/lib/php/20160303

shuba.ivan
  • 3,824
  • 8
  • 49
  • 121