下邊的安裝配置方法,我試了一夜沒有成功,可能由於個人系統環境比較複雜,因此建議:php
先安裝PHP。使用yum命令安裝,在安裝配置MySQL,具體作法看博客中其餘文章,至於Nginx服務器能夠安裝完這兩個以後再安裝配置,由於我目前不使用Nginx,直接使用Apache服務器,因此就沒有在系統上編譯安裝Nginx,目前使用Wordpress,不須要Nginx,只要PHP和Mysql安裝配置好,就能夠了;node
1.下載PHP依賴庫:mysql
wget http://soft.beauty-soft.net/lib/libiconv/libiconv-1.13.1.tar.gzlinux
wget http://soft.beauty-soft.net/lib/mcrypt/libmcrypt-2.5.8.tar.gzsql
wget http://soft.beauty-soft.net/lib/mcrypt/mcrypt-2.6.8.tar.gz數據庫
wget http://soft.beauty-soft.net/lib/mhash/mhash-0.9.9.9.tar.gzapi
wget http://soft.beauty-soft.net/lib/libiconv/php-5.3.6.tar.gz服務器
2.下載後安裝:app
tar zxvf libiconv-1.13.1.tar.gzdom
cd libiconv-1.13.1/
./configure --prefix=/usr/local
make
make install
cd ../
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../
3.安裝PHP:必須加入php-fpm擴展,還有MySQL數據庫的相應擴展;
tar zxvf php-5.3.6.tar.gz
cd php-5.3.6
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
4.執行錯誤:configure: error: xml2-config not found. Please check your libxml2 installation.
解決辦法:
5.執行錯誤:configure: error: libjpeg.(a|so) not found.
解決辦法:
6.執行錯誤:configure: error: libpng.(a|so) not found.
解決辦法:ln -s /usr/lib64/libpng.so /usr/lib/libpng.so
make ZEND_EXTRA_LIBS='-liconv'
7.執行錯誤:make: *** [ext/dom/node.lo] Error 1
解決辦法:在這以前要安裝patch命令到linux中:yum -y install patch
8.執行錯誤:make: *** [sapi/cgi/php-cgi] Error 1
解決辦法:
make install