编译安装php-5.5.15
一、环境
系统:CentOS 6.4x64
IP: 192.168.3.48
二、安装基础软件包
[root@lnmp-test~]#yuminstallzliblibxmllibjpegfreetypelibpnggdcurllibiconvzlib-devellibxml2-devellibxslt-devellibjpeg-develfreetype-devellibpng-develgd-develcurl-develbzip2bzip2-devel-y
三、安装libiconv
#下载软件[root@lnmp-test~]#wgethttp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz[root@lnmp-test~]#tarxflibiconv-1.14.tar.gz[root@lnmp-test~]#cdlibiconv-1.14[root@lnmp-testlibiconv-1.14]#./configure[root@lnmp-testlibiconv-1.14]#make&&makeinstall
四、安装libmcrypt
#下载软件[root@lnmp-test~]#wgethttp://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download[root@lnmp-test~]#tarxflibmcrypt-2.5.8.tar.gz[root@lnmp-test~]#cdlibmcrypt-2.5.8[root@lnmp-testlibmcrypt-2.5.8]#./configure[root@lnmp-testmhash-0.9.9.9]#make&&makeinstall[root@lnmp-testmhash-0.9.9.9]#cdlibltdl/[root@lnmp-testlibltdl]#./configure--enable-ltdl-install[root@lnmp-testlibltdl]#make&&makeinstall#安装mhash[root@lnmp-test~]wgethttp://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz/download[root@lnmp-test~]tarxfmhash-0.9.9.9.tar.gz[root@lnmp-test~]cdmhash-0.9.9.9[root@lnmp-testmhash-0.9.9.9]./configure[root@lnmp-testmhash-0.9.9.9]make&&makeinstall#配置软链接信息[root@lnmp-testmhash-0.9.9.9]#ln-s/usr/local/lib/libmcrypt.la/usr/lib/libmcrypt.la[root@lnmp-testmhash-0.9.9.9]#ln-s/usr/local/lib/libmcrypt.so/usr/lib/libmcrypt.so[root@lnmp-testmhash-0.9.9.9]#ln-s/usr/local/lib/libmcrypt.so.4/usr/lib/libmcrypt.so.4[root@lnmp-testmhash-0.9.9.9]#ln-s/usr/local/lib/libmcrypt.so.4.4.8/usr/lib/libmcrypt.so.4.4.8[root@lnmp-testmhash-0.9.9.9]#ln-s/usr/local/lib/libmhash.a/usr/lib/libmhash.a[root@lnmp-testmhash-0.9.9.9]#ln-s/usr/local/lib/libmhash.la/usr/lib/libmhash.la[root@lnmp-testmhash-0.9.9.9]#ln-s/usr/local/lib/libmhash.so/usr/lib/libmhash.so[root@lnmp-testmhash-0.9.9.9]#ln-s/usr/local/lib/libmhash.so.2/usr/lib/libmhash.so.2[root@lnmp-testmhash-0.9.9.9]#ln-s/usr/local/lib/libmhash.so.2.0.1/usr/lib/libmhash.so.2.0.1[root@lnmp-testmhash-0.9.9.9]#ln-s/usr/local/bin/libmcrypt-config/usr/bin/libmcrypt-config
五、安装mcrypt
#下载软件[root@lnmp-test~]#wgethttp://sourceforge.net/projects/mcrypt/files/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz/download[root@lnmp-test~]#tarxfmcrypt-2.6.8.tar.gz[root@lnmp-test~]#cdmcrypt-2.6.8[root@lnmp-testmcrypt-2.6.8]#/sbin/ldconfig[root@lnmp-testmcrypt-2.6.8]#./configure[root@lnmp-testmcrypt-2.6.8]#make&&makeinstall[root@lnmp-testmcrypt-2.6.8]#/sbin/ldconfig
六、安装php
#下载php软件[root@lnmp-test~]#wgethttp://cn2.php.net/distributions/php-5.5.24.tar.gz[root@lnmp-testphp-5.5.24]#./configure\>--prefix=/usr/local/php-5.5.24\>--with-config-file-path=/usr/local/php-5.5.24/etc\>--enable-fpm\>--with-fpm-user=www\>--with-fpm-group=www\>--with-mysql=mysqlnd\>--with-mysqli=mysqlnd\>--with-pdo-mysql=mysqlnd\>--with-iconv-dir\>--with-freetype-dir\>--with-jpeg-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-mbstring\>--with-mcrypt\>--enable-ftp\>--with-gd\>--enable-gd-native-ttf\>--with-openssl\>--with-mhash\>--enable-pcntl\>--enable-sockets\>--with-xmlrpc\>--enable-zip\>--enable-soap\>--with-gettext\>--disable-fileinfo\>--with-kerberos[root@lnmp-testphp-5.5.24]#makeZEND_EXTRA_LIBS='-liconv'[root@lnmp-testphp-5.5.24]#makeinstall[root@lnmp-testphp-5.5.24]#make&&makeinstall#配置软连接信息[root@lnmp-testphp-5.5.24]#ln-s/usr/local/php-5.5.24/usr/local/php[root@lnmp-testphp-5.5.24]#ln-s/usr/local/php/bin/php/usr/bin/php[root@lnmp-testphp-5.5.24]#ln-s/usr/local/php/bin/pecl/usr/bin/pec[root@lnmp-testphp-5.5.24]#ln-s/usr/local/php/bin/pear/usr/bin/pear[root@lnmp-testphp-5.5.24]#ln-s/usr/local/php/bin/phpize/usr/bin/phpize[root@lnmp-testphp-5.5.24]#ln-s/usr/local/php/sbin/php-fpm/usr/bin/php-fpm#复制配置文件[root@lnmp-testphp-5.5.24]#cpphp.ini-production/usr/local/php/etc/php.ini#[root@lnmp-testphp-5.5.24]#cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf[root@lnmp-testphp-5.5.24]#cat>/usr/local/php/etc/php-fpm.conf<<EOF>[global]>pid=/usr/local/php/var/run/php-fpm.pid>error_log=/usr/local/php/var/log/php-fpm.log>log_level=notice>>[www]>listen=/tmp/php-cgi.sock>listen.backlog=-1>listen.allowed_clients=127.0.0.1>listen.owner=www>listen.group=www>listen.mode=0666>user=www>group=www>pm=dynamic>pm.max_children=10>pm.start_servers=2>pm.min_spare_servers=1>pm.max_spare_servers=6>request_terminate_timeout=100>request_slowlog_timeout=0>slowlog=var/log/slow.log>EOF#[root@lnmp-testphp-5.5.24]#sed-i's@;pid=run/php-fpm.pid@pid=run/php-fpm.pid@'/usr/local/php/etc/php-fpm.conf[root@lnmp-testphp-5.5.24]#cpsapi/fpm/init.d.php-fpm/etc/init.d/php-fpm[root@lnmp-testphp-5.5.24]#chmod+x/etc/init.d/php-fpm[root@lnmp-testphp-5.5.24]#/etc/init.d/php-fpmstartStartingphp-fpmdone[root@lnmp-testphp-5.5.24]#psaux|grepphproot79920.00.42032084864?Ss13:500:00php-fpm:masterprocess(/usr/local/php-5.5.24/etc/php-fpm.conf)www79930.00.42032084284?S13:500:00php-fpm:poolwwwwww79940.00.42032084284?S13:500:00php-fpm:poolwwwroot79990.00.0103248836pts/0S+13:500:00grepphp
七、安装zendopcache
#下载软件[root@lnmp-test~]#wgethttp://pecl.php.net/get/zendopcache-7.0.3.tgz[root@lnmp-test~]#tarxfzendopcache-7.0.3.tgz[root@lnmp-test~]#cdzendopcache-7.0.3[root@lnmp-testzendopcache-7.0.3]#phpize[root@lnmp-testzendopcache-7.0.3]#./configure--with-php-config=/usr/local/php/bin/php-config[root@lnmp-testzendopcache-7.0.3]#make&&makeinstall#安装完成后会出现如下信息Installingsharedextensions:/usr/local/php-5.5.24/lib/php/extensions/no-debug-non-zts-20121212/[root@lnmp-testzendopcache-7.0.3]#cat>>/usr/local/php/etc/php.ini<<EOF>[opcache]>zend_extension=opcache.so>opcache.memory_consumption=128>opcache.interned_strings_buffer=8>opcache.max_accelerated_files=4000>opcache.revalidate_freq=60>opcache.fast_shutdown=1>opcache.enable_cli=1>EOF#重启php-fpm服务即可[root@lnmp-testzendopcache-7.0.3]#servicephp-fpmrestartGracefullyshuttingdownphp-fpm.doneStartingphp-fpmdone#将php-fpm添加到开机自动启动[root@lnmp-testzendopcache-7.0.3]#chkconfig--addphp-fpm[root@lnmp-testzendopcache-7.0.3]#chkconfigphp-fpmon
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。