mac MAMP php7.4.15安装扩展pcntl

1、下载php7.4.15

下载地址:https://www.php.net/releases/

2、替换安装包,编译安装

命令如下:

tar -xzvf php-7.4.15.tar.gz
mv php-7.4.14 php
mkdir -p /Applications/MAMP/bin/php/php7.4.15/include
mv php /Applications/MAMP/bin/php/php7.4.15/include

3、编译 pcntl.so 文件

cd ext/pcntl
/Applications/MAMP/bin/php/php7.4.15/bin/phpize
./configure --with-php-config=//Applications/MAMP/bin/php/php7.4.15/bin/php-config
make install

4、向php.ini 文件中添加该扩展

MAMP_apc_MAMPextension=apcu.so
MAMP_apc_MAMPextension=apc.so
extension=imap.so
extension=gettext.so
extension=pgsql.so
extension=pdo_pgsql.so
extension=pgsql.so

5、检测扩展是否成功

/Applications/MAMP/bin/php/php7.4.15/bin/php --ri pcntl
pcntl
pcntl support => enabled

 

错误解决1:

configure: error: in `/Applications/MAMP/bin/php/php7.4.15/include/php':
configure: error: The pkg-config script could not be found or is too old.  Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.

解决办法:brew install pkg-config

 

错误解决2:

configure: error: Please specify the install prefix of iconv with --with-iconv=<DIR>

解决办法:./configure --without-iconv

 

错误解决3:

/Applications/MAMP/bin/php/php7.4.15/include/php/ext/pcntl/pcntl.c:32:10: fatal error: 'php.h' file not found

解决办法:sudo xcode-select --install

 

错误解决4:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

解决办法:

sudo rm -rf /Library/Developer/CommandLineTools

sudo xcode-select --install

 

posted @ 2021-12-23 16:06  北漂生活  阅读(559)  评论(0编辑  收藏  举报