[英]How to install php extensions via pecl for different php versions on Mac
I am not able to install php extensions like apcu for different php versions separately.我无法为不同的 php 版本分别安装 apcu 等 php 扩展。 I am running php7.1 and php7.3 (installed via brew) on MacOS Mojave
我在 MacOS Mojave 上运行 php7.1 和 php7.3(通过 brew 安装)
I already tried things like pecl -d php_suffix=7.1 install <package>
as I found this suggestion here.我已经尝试过像
pecl -d php_suffix=7.1 install <package>
因为我在这里找到了这个建议。 But it doesn't work at all.但它根本不起作用。
The specific problem is to install apcu for php7.1 while php7.3 is also installed.具体问题是php7.1安装apcu的同时安装php7.3。 No matter what I do - apcu get's only available for php7.3.
无论我做什么 - apcu get 仅适用于 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当我运行
php -v
我得到PHP 7.1
当我检查目录/usr/local/Cellar/php@7.1/7.1.30_1/include/php/ext
,没有 apcu
Isn't there any way of telling pecl for which version it is supposed to install the extension?有没有办法告诉 pecl 应该为哪个版本安装扩展?
Now I got it.现在我明白了。 Found it here: https://discourse.brew.sh/t/pecl-with-multiple-php-versions/1977
在这里找到: 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 链接到
/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
Pecl 随每个 php 版本一起提供,可以在(例如)
/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.现在你只需要在那里 cd 并使用这个显式版本的 pecl。
So if one want to install an extension for php7.1:因此,如果您想为 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:因此,如果您想为 php7.3 安装一个扩展:
/usr/local/Cellar/php@7.3/bin/pecl install <package-name>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.