How install apcu as php7 extension on debian
Asked Answered
F

7

27

I have seen this tutorial for ubuntu. http://thereluctantdeveloper.com/2015/12/quick-and-dirty-php-70-set-up-on-ubuntu-1404-with-apcu

It's not clear for me after step(git clone). I need apcu extension for my app to perform faster. Please guide to install apcu extension for php 7 on debian.

Foreleg answered 9/12, 2015 at 3:54 Comment(5)
Have you installed the compiled extension? serverpilot.io/community/articles/… or php.net/manual/en/book.apc.phpArella
In severpilot.io,I got "pecl7.0-sp not found".In PHP.net,It is for php5.Foreleg
Methods for PECL extension installation is same for php5.x and php7.x. Nothing much changes; unless the source conflicts with php7.x. Please try compiling manually from the source and let us know whether it helped. Else you have to contact the maintainer to check if present version supports php7.x pecl.php.net/package/APCu . Windows php7.x binary versions are already available for APCuArella
php.net/manual/en/install.pecl.intro.php please check this as wellArella
https://mcmap.net/q/439843/-pecl-command-not-found similar errorArella
E
32

First, I'm assuming you installed PHP7 using the DotDeb APT Repository. If not, this is how you should install it.

Once PHP7 is installed and working properly, and assuming there are no other versions of PHP installed on the system, install apcu via:

sudo apt-get install php7.0-dev
pecl channel-update pecl.php.net
pecl install apcu

echo "extension=apcu.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`

Just press enter if prompted to specify any configuration.

Elspeth answered 3/1, 2016 at 8:13 Comment(4)
David P's answer below (probably soon deleted, as it's really a comment) suggests that "acpu" should be "apcu" in various parts of your sample code.Arenas
I always get ...compilation terminated. make: *** [apc.lo] Error 1 ERROR: make' failed ` after pecl install apcuCotswold
php7.0-dev package must be installed for successful compileDepend
The last echo line produces a permission denied with with sudoPancake
K
20

I know that this post is old but I would like to contrib with the way that works for me, because I tried the three answers in this question and I couldn't install APCU successfully. My problem with the answers wasn't the installation of APCU, pecl install apcu works and installed it. But I try to add the extension line in php.ini following each method, but neither of them works for me. I checked in a php file with phpinfo() and it always didn't show the APCU as installed extension.

After research more in the search results I found a easy way to install it in WPBullet. What I did was to install the packages php-apcu and php-apcu-bc with:

sudo apt-get install php7.0-apcu

This works for me without manual writting in php.ini. Don't forget to restart apache2, or whatever you have as server.

Kyrstin answered 11/10, 2017 at 10:34 Comment(4)
I get Unable to locate package php7.0-apcu after an apt-get update.Pola
@Andru, have you tried to install it separately both packages php-apcu and php-apcu-bc?Kyrstin
Or for php7.1, sudo apt-get install php7.1-apcuRadke
Obvious, but just in case, for php 7.3 eventually becomes sudo apt-get install php7.3-apcu :)Selfgratification
T
10

Run :

sudo apt-get install php7.0-dev
pecl channel-update pecl.php.net
pecl install apcu

Do not immediately add extension=apcu.so on php.ini without checking. extension=apcu.so should automatically get added on /etc/php/7.0/cli/conf.d/20-apcu.ini. You can run php -i | grep app to check or cat /etc/php/7.0/cli/conf.d/20-apcu.ini. If you load twice, you'll get :

PHP Warning:  Module 'apcu' already loaded in Unknown on line 0

This message is probably kept for older system :

install ok: channel://pecl.php.net/apcu-5.1.5
configuration option "php_ini" is not set to php.ini location
You should add "extension=apcu.so" to php.ini

I can not comment on the existing answer (point is less than 50). I got that PHP error, then found that file.

Tectonics answered 19/9, 2016 at 3:31 Comment(0)
T
8

Check /etc/php/(version like 7.2)/cli/conf.d directory and find 20-apcu.ini. If you dont see it there, You need to install it. To install follow bellow command:

sudo apt-get install php7.2-apcu

Now add bellow line in php.ini file if it is not there.

extension=apcu.so

Notice: for php7.2-apcu use your own php version. for example php7.0-apcu

After install restart your php7.X-fpm service if you are using nginx

sudo service php7.2-fpm restart

Now reload nginx

sudo service nginx reload

or reload apache, if you are using it:

sudo service apache2 reload
Transcontinental answered 10/12, 2018 at 17:23 Comment(0)
Z
6

Just installed APCu on a Ubuntu 14.04.3 LTS with PHP 7.0.3-2:

$ pecl install apcu
$  cat > /etc/php/mods-available/test.ini
; configuration for php apcu module
; priority=20
extension=apcu.so
$ ln -s /etc/php/mods-available/apcu.ini /etc/php/7.0/fpm/conf.d/20-apcu.ini
$ service php7.0-fpm restart

phpinfo() output:

phpinfo-apcu

Zoubek answered 30/10, 2016 at 9:55 Comment(0)
P
4

I use Ubuntu 20.04 and php-fpm 7.4. To install apcu:

apt install php-apcu
Pendergrass answered 16/1, 2021 at 9:53 Comment(2)
Works for Debian 10 and 11 too.Volta
Thank you for the information. Since Ubuntu is a derivative of Debian, many of the commands are the same.Pendergrass
X
1

for PHP7.3 use following commands

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

sudo service php7.3-fpm restart

sudo service apache2 restart
Xray answered 10/3, 2021 at 10:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.