Mac OSX编译安装php5.6

安装好OSX 10.13以后默认自带的php7.1.7,跟现有环境不兼容,所以准备编译安装php5.6,自带的php7不建议卸载,重新安装一份php5.6

1.安装php的一些依赖,推荐使用brew安装,如何安装brew可以百度下,不在此说明

libmcrypt jpeg freetype libxml++ pcre readline libpng gettext 

2.下载安装包

http://cn2.php.net/distributions/php-5.6.21.tar.gz

tar zxvf php-5.6.21.tar.gz
cd php-5.6.21
./configure 
--prefix=/usr/local/php 
--with-config-file-path=/usr/local/php/etc 
--with-openssl=/usr/local/opt/openssl 
--with-zlib 
--with-bz2 
--with-gd 
--with-jpeg-dir 
--with-png-dir 
--with-gettext 
--with-mhash 
--with-freetype-dir 
--with-mcrypt 
--with-iconv 
--with-curl 
--with-xmlrpc 
--with-mysql 
--with-pdo-mysql 
--with-mysqli 
--enable-calendar 
--enable-pdo 
--enable-zip 
--enable-mbstring 
--enable-mbregex 
--enable-bcmath 
--enable-soap 
--enable-sockets 
--enable-ftp 
--enable-gd-native-ttf 
--enable-shmop 
--enable-sysvmsg 
--enable-sysvsem 
--enable-sysvshm 
--enable-xml 
--enable-pcntl 
--enable-fpm 
--enable-opcache 
--without-pear 

make && make install 

上述编译过程中遇到啥问题请参考链接

https://www.cnblogs.com/52php/p/5683356.html

http://blog.csdn.net/fafa211/article/details/48807625

原文地址:https://www.cnblogs.com/Kevin-1967/p/8579591.html