1. wget http://au1.php.net/distributions/php-5.6.36.tar.gz //下載安裝包php
2. tar -jxvf php-5.6.32.tar.bz2 //解壓文件mysql
3. ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/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-exifsql
//初始化phpapache
configure: error: xml2-config not found. Please check your libxml2 installation.php7
解決辦法: yum install libxml2-devel less
configure: error: Cannot find OpenSSL's socket
解決辦法 : yum install openssl-develspa
configure: error: Please reinstall the BZip2 distribution.net
解決辦法: yum install bzip2-develorm
configure: error: jpeglib.h not found.
解決辦法: yum iinstall libjpeg-devel
configure: error: png.h not found.
解決辦法: yum install libpng-devel
configure: error: freetype-config not found.
解決辦法:yum install freetype-devel
configure: error: mcrypt.h not found. Please reinstall libmcrypt
解決辦法: yum install epel-release
yum install libmcrypt-devel
make //
install make //
4. /usr/local/php/bin/php -m //查看加載的模塊
php是做爲apache擴展模塊存在的,不須要啓動
5. cp php.ini-production /usr/local/php/etc/php.ini //拷貝配置文件
usr/local/php/bin/php -i|less 查看php配置信息
1. wget http://au1.php.net/distributions/php-7.2.5.tar.gz //下載安裝包
2. tar -zxvf php-7.2.5.tar.gz //解壓文件
3. ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php7/etc --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 //初始化
make //編譯
make install //安裝
4. cp /usr/local/php-7.2.5/php.ini-production /usr/local/php7/etc/php.ini //拷貝配置文件
報錯:
error: libxml2 not found. Please check your libxml2 installation.
No package OpenSSL available.
configure: error: Please reinstall the BZip2 distributionconfigure: error: jpeglib.h not found.
configure: error: png.h not found.
configure: error: freetype-config not found.
configure: error: wrong mysql library version or lib not found. Check config.log for more information.
yum install libxml2-devel
yum install openssl-devel
yum -y install bzip2-devel
yum -y install libjpeg-develyum install freetype-devel