本文共 2152 字,大约阅读时间需要 7 分钟。
PHP官网www.php.net
当前主流版本为5.6/7.1cd /usr/local/src/ wget http://cn2.php.net/distributions/php-5.6.30.tar.gztar zxf php-5.6.30.tar.gzcd php-5.6.30./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
下面开始漫长的排错过程
yum provides xml2-configyum install -y libxml2-develyum list |grep -i openssl yum install -y openssl openssl-develyum install -y bzip2-develyum install -y libjpeg-develyum install -y libpng-develyum install -y freetype-develyum install -y epel-releaseyum install -y libmcrypt-devel继续./configure ...make && make installcp php.ini-production /usr/local/php/etc/php.ini //拷贝配置文件安装完成后我们找下看是否生成了我们要的php模块libphp5.sols /usr/local/apache2.4/modules/libphp5.so 可以找到du -sh !$ 查看下它的大小 ,发现36M左右至此说明我们php安装成功了php7 安装方法跟php5相同,就是./configure 时改下安装路径,和配置文件路径cd /usr/local/src/ wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2tar zxf php-7.1.6.tar.bz2cd php-7.1.6./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exifmake && make install
ls /usr/local/apache2.4/modules/libphp*
cp php.ini-production /usr/local/php7/etc/php.ini最后我们把要下载的包总结下:yum install -y libxml2-devel yum install -y openssl openssl-devel yum install -y bzip2-devel yum install -y libjpeg-devel yum install -y libpng-devel yum install -y freetype-devel yum install -y epel-release yum install -y libmcrypt-devel
转载于:https://blog.51cto.com/12606610/2097191