CentOS PHP5.6源碼安裝

安裝編譯環境

yum install gcc-c++

新建安裝目錄

mkdir -p /usr/local/php5.6 && cd /usr/local/php5.6

下載源碼

wget http://cn2.php.net/get/php-5.6.40.tar.bz2/from/this/mirror

解壓

tar zxvf php-5.6.40.tar.gz 

移動

cd /usr/local/php5.6/php-5.6.40/ && mv * .. && cd .. && rm -rf /usr/local/php5.6/php-5.6.40/

配置

./configure  --prefix=/usr/local/php --enable-fpm --with-fpm-user=daemon --with-fpm-group=daemon --with-config-file-path=/usr/local/php/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-gd --with-zlib --with-libxml-dir --with-curl --with-curlwrappers --with-mhash --with-xmlrpc --with-openssl --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-gd-native-ttf --enable-ftp --enable-pcntl --enable-sockets --enable-zip --enable-soap --disable-debug --disable-ipv6

安裝

make -j 4
make install

php虛擬機運行配置文件

find . -name php.ini\*
# 移動php文件運行配置到之前配置好的配置目錄
cp -rf php.ini-production /usr/local/php/etc/

find . -name php-fpm\*
# 移動php虛擬機運行配置到之前配置好的配置目錄
cp -rf ./sapi/fpm/php-fpm.conf /usr/local/php/etc/

配置systemV控制腳本

find . -name init\*
cp -rf ./sapi/fpm/init.d.php-fpm /etc/init.d/
cd /etc/init.d/
mv init.d.php-fpm php-fpm
chmod a+x /etc/init.d/php-fpm 

配置php.ini

cd /usr/local/php/
cd etc/
mv php.ini-production php.ini

配置 php-fpm.conf

vim php-fpm.conf
#用戶組
listen.owner = daemon
listen.group = daemon
listen.mode = 0660

#修改監聽soket
listen = /dev/shm/php.socket

啓動

/etc/init.d/php-fpm start

安裝可能出現的錯誤依賴記錄

錯誤一

checking for xml2-config path... 
configure: error: xml2-config not found. Please check your libxml2 installation.
# yum list libxml2*

yum install libxml2-devel.x86_64 libxml2-static.x86_64

錯誤二

checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
    easy.h should be in <curl-dir>/include/curl/
yum install curl curl-devel

錯誤三

checking whether to enable JIS-mapped Japanese font support in GD... no
If configure fails try --with-vpx-dir=<DIR>
configure: error: jpeglib.h not found.
yum install libjpeg-turbo.x86_64 libjpeg-turbo-devel.x86_64 libjpeg-turbo-static.x86_64

錯誤四

If configure fails try --with-vpx-dir=<DIR>
checking for jpeg_read_header in -ljpeg... yes
configure: error: png.h not found.
yum install libpng-devel.x86_64 libpng-static.x86_64

錯誤五

checking for jpeg_read_header in -ljpeg... yes
checking for png_write_image in -lpng... yes
If configure fails try --with-xpm-dir=<DIR>
configure: error: freetype-config not found.
yum install freetype-devel.x86_64
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章