1. 程式人生 > >CentOS.6.6中 PHP-5.5.38安裝配置

CentOS.6.6中 PHP-5.5.38安裝配置

php php-5.5.38安裝配置 centos.6.6

PHP-5.5.38安裝配置

  1. 檢查並安裝相關依賴包

[[email protected] tools]# rpm -qazlib-devel libxml2-devel libjpeg-turbo-devel libiconv-devel

[[email protected] tools]# rpm -qafreetype-devel libpng-devel gd-devel libcurl-devel libxslt libxslt-devel pcrepcre-devel

[[email protected] tools]# yum -yinstall zlib-devel libxml2-devel libjpeg-turbo-devel libiconv-devel

[[email protected] tools]# yum -yinstall freetype-devel libpng-devel gd-devel libcurl-devel libxslt libxslt-develpcre pcre-devel

註意yum源裏無libiconv-devel包,需要用源碼包單獨安裝

[[email protected] tools]# wgethttp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

[[email protected] tools]# tar zxvflibiconv-1.14.tar.gz

[[email protected] tools]# cdlibiconv-1.14

[[email protected] libiconv-1.14]#./configure --prefix=/usr/local/libiconv

[[email protected] libiconv-1.14]#make

[[email protected] libiconv-1.14]#make install

  1. 安裝libmcrypt-develmcryptmhashmhash-devel包,由於官方yum源裏無此四個包,所以選擇epel yum源安裝

[[email protected] ~]# wget -O/etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo ###安裝epel yum源,此yum源於官方的不沖突,官方找不到需要的包時,才會從epel裏找相應的包

[[email protected] ~]# yum -y installlibmcrypt-devel mcrypt mhash mhash-devel

  1. 編譯安裝PHP

[[email protected] php-5.5.38]#./configure --prefix=/application/php-5.5.38 --with-mysql=mysqlnd--with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-png-dir--with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath--enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl--enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd--enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl--enable-sockets --with-xmlrpc --enable-soap --enable-short-tags--enable-static --with-xsl --with-fpm-user=nginx --with-fpm-group=nginx --enable-ftp

[[email protected] php-5.5.38]# make

===============================================================================

編譯過程中報錯1

/home/wangning/tools/php-5.5.38/sapi/cli/php:error while loading shared libraries: libmysqlclient.so.18: cannot open sharedobject file: No such file or directory

make: *** [ext/phar/phar.php]Error 127

解決報錯1方法:

[[email protected] php-5.5.38]# ln -s/application/mysql/lib/libmysqlclient.so.18 /usr/lib64/

[[email protected] php-5.5.38]# touchext/phar/phar.phar

或者

[[email protected] php-5.5.38]# echo"/application/mysql/lib">>/etc/ld.so.conf

[[email protected] php-5.5.38]# ldconfig

編譯過程中報錯2

/usr/bin/ld: cannot find -lltdl

collect2: ld returned 1 exitstatus

make: *** [sapi/fpm/php-fpm]Error 1

解決報錯2方法:

[[email protected] php-5.5.38]# yum-y install libtool-ltdl-devel

===============================================================================

[[email protected] php-5.5.38]# makeinstall

[[email protected] php-5.5.38]# ln -s/application/php5.3.27/ /application/php

  1. 配置php配置文件

[[email protected] php-5.5.38]# cpphp.ini-production /application/php/lib/php.ini

[[email protected] php-5.5.38]# cp/application/php/etc/php-fpm.conf.default /application/php/etc/php-fpm.conf

把配置好的php-fpm.conf上傳到/application/php/etc目錄下

php-fpm.conf見附件

[[email protected] etc]# mkdir/app/logs -p ###創建logs目錄,php-fpm.conf文件裏定義的日誌路徑

[[email protected] etc]#/application/php/sbin/php-fpm ###啟動PHP服務

[[email protected] etc]# ps -ef|grepphp ###查看php進程

[[email protected] etc]# lsof -i:9000 ###通過端口號查看php進程是否起來


本文出自 “飛奔的駱駝” 博客,請務必保留此出處http://wn2100.blog.51cto.com/9915310/1941570

CentOS.6.6中 PHP-5.5.38安裝配置