1. 程式人生 > >php5.6的安裝

php5.6的安裝

PHP php5.6 php5.6安裝

安裝PHP5

PHP官網:www.php.net
當前主流版本為5.6/7.1
安裝php之前必須先安裝好mysql和Apache

下載與解壓

cd /usr/local/src/
wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
tar zxvf php-5.6.30.tar.gz

安裝文件

cd /usr/local/src/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

編譯與安裝

make && make install

設置加載文件

cp /usr/local/src/php-5.6.30/php.ini-production /usr/local/php/etc/php.ini

查看配置文件加載目錄

/usr/local/php/bin/php -i |less

安裝內容的信息註釋

--prefix= php的安裝路徑
--with-apxs2= apache的apxs工具目錄
--with-config-file-path= 指定配置文件路徑
--with-mysql= 指定MySQL的路徑

--with-pdo-mysql=
--with-mysqli=
後面所有--with-都是指定模塊


安裝告錯以及處理

告錯1:

錯誤信息:
configure: error: xml2-config not found. Please check your libxml2 installation.

處理方案:
缺少xml2這個包,搜索並安裝它;一般安裝的都是庫文件,也就是後面帶devel的包;
yum list |grep xml2
yum install -y libxml2-devel

告錯2:

錯誤信息:
configure: error: Cannot find OpenSSL‘s <evp.h>

處理方案:
缺少openssl包,搜索並安裝它;一般安裝的都是庫文件也就是openssl-devel;
yum list |grep openssl
yum install -y openssl-devel

告錯3:

錯誤信息:
configure: error: Please reinstall the BZip2 distribution

處理方案:
缺少bzip2的包,搜索並安裝它的庫文件;
yum list |grep -i bzip2
yum install -y bzip2-devel

告錯4:

錯誤信息:
configure: error: jpeglib.h not found.

處理方案:
這個缺少的是libjpeg-devel包,但是系統裏面沒有libjpeg-devel,搜索jpeglib是搜索不出的;
最後匹配出的包為libjpeg-turbo-devel
yum list |grep -i jpeg
yum install -y libjpeg-devel

告錯5:

錯誤信息:
configure: error: png.h not found.

解決方案:
缺少libpng-devel包,搜索錯誤提示的png查詢;
yum list |grep -i png
yum install -y libpng-devel

告錯6:

錯誤信息:
configure: error: freetype-config not found.

解決方案:
缺少freetype-devel,最好先搜索再安裝;
yum list |grep -i freetype
yum install -y freetype-devel

告錯7:

錯誤信息:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.

解決方案:
缺少mcrypt,請先安裝epel-release再安裝mcrypt;
重要事情說三遍:一定要先安裝epel-release後再安裝libtomcrypt-devel;
重要事情說三遍:一定要先安裝epel-release後再安裝libtomcrypt-devel;
重要事情說三遍:一定要先安裝epel-release後再安裝libtomcrypt-devel;
yum install -y epel-release
yum list |grep -i mcry
yum install -y libtomcrypt-devel

如果不成功那麽使用yum移除這兩個包重新安裝
yum erase epel-release.noarch
yum erase libtomcrypt

php5.6的安裝