- 下载源码
wget http://cn.php.net/distributions/php-7.2.30.tar.xz
注:也可以通过pecl install pcntl安装 或 pecl download pcntl 安装,附:下载并安装pecl脚本 cd /usr/local/php/bin/ curl -o go-pear.php http://pear.php.net/go-pear.phar ./php go-pear.php
- 解压
tar -xzvf php-7.2.30.tar.gz
- 到pcntl扩展的目录
cd php-7.2.30/ext/pcntl
-
编译
/Applications/MAMP/bin/php/php7.2.30/bin/phpize ./configure --prefix=/Applications/MAMP/bin/php/php7.2.30/bin/php --with-php-config=/Applications/MAMP/bin/php/php7.2.30/bin/php-config make && make install #输出类似下文 Installing shared extensions: /Applications/MAMP/bin/php/php7.2.30/lib/php/extensions/no-debug-non-zts-20170718/
-
找出当前PHP的配置文件的位置
php -i | grep Loaded # 输出 Loaded Configuration File => /Library/Application Support/appsolute/MAMP PRO/conf/php7.2.30.ini libXML Loaded Version => 20800 Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password,auth_plugin_caching_sha2_password,auth_plugin_sha256_password
可以看出配置文件是:
/Library/Application Support/appsolute/MAMP PRO/conf/php7.2.30.ini
-
编辑配置文件,增加一行
extension=pcntl.so
- 检查是否安装成功
php --ri pcntl
PHP 7.2.30 安装 pcntl 扩展
最新推荐文章于 2024-06-11 20:14:21 发布