在MacOS编译安装php7.4

以前在我的centos7服务器上编译安装了php7.3,这一次先打算在自己的mac上试一试php7.4。

# 下载源码
wget https://www.php.net/distributions/php-7.4.1.tar.bz2

# 解压&切换到目录下
tar -jxvf php-7.4.1.tar.bz2 && cd php-7.4.1

# 执行configure
./configure --prefix=/usr/local/opt/php@7.4 --with-config-file-path=/usr/local/etc/php/7.4 --enable-fpm --with-fpm-user=_www --with-fpm-group=_www --enable-intl --enable-mbstring --enable-pcntl --enable-mysqlnd

报错:

checking for icu-uc >= 50.1 icu-io icu-i18n... no
configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:

No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables ICU_CFLAGS
and ICU_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

执行

export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"

再次configurre

./configure --prefix=/usr/local/opt/php@7.4 --with-config-file-path=/usr/local/etc/php/7.4 --enable-fpm --with-fpm-user=_www --with-fpm-group=_www --enable-intl --enable-mbstring --enable-pcntl --enable-mysqlnd

报错:

configure: error: Package requirements (oniguruma) were not met:

No package 'oniguruma' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables ONIG_CFLAGS
and ONIG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

安装oniguruma

参考:http://macappstore.org/oniguruma/

brew install oniguruma

# 再次configurre
./configure --prefix=/usr/local/opt/php@7.4 --with-config-file-path=/usr/local/etc/php/7.4 --enable-fpm --with-fpm-user=_www --with-fpm-group=_www --enable-intl --enable-mbstring --enable-pcntl --enable-mysqlnd

## 最后
make && make install

One thought on “在MacOS编译安装php7.4”

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注