MacOS编译安装PHP5.6

PHP:安装PHP5.6

安装依赖可以省略,缺少哪个装哪个即可,类似linux

yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel -y

下载版本

wget https://www.php.net/distributions/php-5.6.40.tar.gz
./configure --prefix=/Users/user/Applications/php/5.6.40 \
--with-config-file-path=/Users/user/Applications/php/5.6.40/etc \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-fpm  \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir \
--with-freetype-dir \
--with-jpeg-dir=/usr/local/Cellar/jpeg/9e \
--with-png-dir \
--with-zlib \
--with-libxml-dir \
--disable-fileinfo \
--disable-rpath \
--disable-debug \
--enable-bcmath \
--enable-xml \
--enable-shmop \
--enable-exif \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-ftp \
--with-curl \
--with-xsl \
--with-gettext \
--enable-zip \
--enable-soap \
--with-openssl="/usr/local/Cellar/[email protected]/1.1.1q"
make && make install

配置文件

cp php.ini-production /Users/user/Applications/php/5.6.40/etc/php.ini

问题

问题1

configure: error: jpeglib.h not found.

安装

brew install libjpeg

添加到环境变量

~/.bash_profile

# libjpeg
export PATH="/usr/local/opt/jpeg/bin:$PATH"

问题2

configure: error: Cannot find OpenSSL’s <evp.h>

指定openssl的路径

--with-openssl="/usr/local/Cellar/[email protected]/1.1.1q"

参考

猜你喜欢

转载自blog.csdn.net/mouday/article/details/135174622