-
-
Notifications
You must be signed in to change notification settings - Fork 26
PECL Installation
Ondřej Surý edited this page Jul 8, 2020
·
3 revisions
When you have e.g. php7.4 / php5.6 installed and you want to install any PECL packages you must be aware, that you need to switch the alternatives before you start compiling:
Before you run any pecl command, you switch your PHP version to the version you want the PECL module to be installed for. Lets say we pick php5.6
update-alternatives --set php /usr/bin/php5.6
update-alternatives --set php-config /usr/bin/php-config5.6
update-alternatives --set phpize /usr/bin/phpize5.6
Now you can run the installation
pecl install mongodb
Since you just switched your default PHP version you might just to go back to your real default you probably had before, let's say PHP7
update-alternatives --set php /usr/bin/php7.0
update-alternatives --set php-config /usr/bin/php-config7.0
update-alternatives --set phpize /usr/bin/phpize7.0
When you do not want to update the alternatives, e.g. because you have running services and feel unsure, you can go and install those packages the manual. Lets say, again for mongodb
wget https://pecl.php.net/get/mongodb-1.1.7.tgz
tar xf mongodb-1.1.7.tgz
cd mongodb-1.1.7
phpize5.6
./configure --with-php-config=php-config5.6