源码编译安装PHP 5.6.29
准备工作
1.yum安装所需软件包
#yuminstall-ygccgcc-c++makezlibzlib-develpcrepcre-devellibjpeglibjpeg-devellibpnglibpng-develfreetypefreetype-devellibxml2libxml2-develglibcglibc-develglib2glib2-develbzip2bzip2-develncursesncurses-develcurlcurl-devele2fsprogse2fsprogs-develkrb5krb5-developensslopenssl-developenldapopenldap-develnss_ldapopenldap-clientsopenldap-servers1
2.yum源没有libmcrypt包,采用源码安装。
#cd/usr/local/src/#wgethttp://ncu.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz#./configureprefix=/usr/local/libmcrypt#make&&makeinstall#echo$?12345
3.下载php源码包,解压
#wgethttp://am1.php.net/distributions/php-5.6.29.tar.bz2#tarjxvfphp-5.6.29.tar.bz2#cdphp-5.6.29123
安装过程
1.创建用户php-fpm
#useradd-s/sbin/nologinphp-fpm
准备工作
1.yum安装所需软件包
#yuminstall-ygccgcc-c++makezlibzlib-develpcrepcre-devellibjpeglibjpeg-devellibpnglibpng-develfreetypefreetype-devellibxml2libxml2-develglibcglibc-develglib2glib2-develbzip2bzip2-develncursesncurses-develcurlcurl-devele2fsprogse2fsprogs-develkrb5krb5-developensslopenssl-developenldapopenldap-develnss_ldapopenldap-clientsopenldap-servers1
2.yum源没有libmcrypt包,采用源码安装。
#cd/usr/local/src/#wgethttp://ncu.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz#./configureprefix=/usr/local/libmcrypt#make&&makeinstall#echo$?12345
3.下载php源码包,解压
#wgethttp://am1.php.net/distributions/php-5.6.29.tar.bz2#tarjxvfphp-5.6.29.tar.bz2#cdphp-5.6.29123
安装过程
1.创建用户php-fpm
#useradd-s/sbin/nologinphp-fpm
3.编译和安装
#make&&makeinstall#echo$?12
4.修改配置文件
#cpphp.ini-production/usr/local/php/etc/php.ini#vim/usr/local/php/etc/php-fpm.conf#/usr/local/php/sbin/php-fpm-t123
php-fpm.conf修改项如下:[global]pid=/usr/local/php/var/run/php-fpm.piderror_log=/usr/local/php/var/log/php-fpm.log[www]listen=/tmp/php-fcgi.sockuser=php-fpmgroup=php-fpmpm=dynamicpm.max_children=50pm.start_servers=20pm.min_spare_servers=5pm.max_spare_servers=35pm.max_requests=500rlimit_files=1024运行/usr/local/php/sbin/php-fpm-t,若结果为“testissuccessful”,则配置正确。
5.拷贝php-fpm启动脚本到/etc/init.d/,更改权限
#cp/usr/local/src/php-5.6.29/sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm#chmod755/etc/init.d/php-fpm#servicephp-fpmstart123
若使php-fpm开机启动,运行chkconfig--addphp-fpm;chkconfigphp-fpmon。查看服务是否启动,运行psaux|grepphp。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。