-1

I am not able to install php extensions like apcu for different php versions separately. I am running php7.1 and php7.3 (installed via brew) on MacOS Mojave

I already tried things like pecl -d php_suffix=7.1 install <package> as I found this suggestion here. But it doesn't work at all.

The specific problem is to install apcu for php7.1 while php7.3 is also installed. No matter what I do - apcu get's only available for php7.3.

When I run php -v I get PHP 7.1 When I check the directory /usr/local/Cellar/php@7.1/7.1.30_1/include/php/ext there is no apcu

Isn't there any way of telling pecl for which version it is supposed to install the extension?

m00cfe81
  • 91
  • 1
  • 5
  • "it doesn't work at all" isn't very clear. are you getting any error messages? – rebecca Jul 18 '19 at 12:44
  • Sorry - you're right. No - in the specific case when trying to install apcu it just installs the extension for php7.3 - regardless what I do – m00cfe81 Jul 18 '19 at 13:37

1 Answers1

7

Now I got it. Found it here: https://discourse.brew.sh/t/pecl-with-multiple-php-versions/1977

pecl was linked to /usr/local/Cellar/php/7.3.7/bin/pecl

Pecl comes with each php Version and can be found (for example) in /usr/local/Cellar/php@7.1/7.1.30_1/bin

Now you just have to cd there and use this explicit version of pecl.

So if one want to install an extension for php7.1:

/usr/local/Cellar/php@7.1/7.1.30_1/bin/pecl install <package-name>

So if one want to install an extension for php7.3:

/usr/local/Cellar/php@7.3/bin/pecl install <package-name>

m00cfe81
  • 91
  • 1
  • 5