为了账号安全,请及时绑定邮箱和手机立即绑定

CentOS.6.6中 PHP-5.5.38安装配置

标签:
PHP

PHP-5.5.38安装配置

 

 

  1. 检查并安装相关依赖包

[root@lnmp02 tools]# rpm -qazlib-devel libxml2-devel libjpeg-turbo-devel libiconv-devel

[root@lnmp02 tools]# rpm -qafreetype-devel libpng-devel gd-devel libcurl-devel libxslt libxslt-devel pcrepcre-devel

[root@lnmp02 tools]# yum -yinstall zlib-devel libxml2-devel libjpeg-turbo-devel libiconv-devel

[root@lnmp02 tools]# yum -yinstall freetype-devel libpng-devel gd-devel libcurl-devel libxslt libxslt-develpcre pcre-devel

注意yum源里无libiconv-devel包,需要用源码包单独安装

[root@lnmp02 tools]# wgethttp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

[root@lnmp02 tools]# tar zxvflibiconv-1.14.tar.gz

[root@lnmp02 tools]# cdlibiconv-1.14

[root@lnmp02 libiconv-1.14]#./configure --prefix=/usr/local/libiconv

[root@lnmp02 libiconv-1.14]#make

[root@lnmp02 libiconv-1.14]#make  install

  1. 安装libmcrypt-devel、mcrypt、mhash、mhash-devel包,由于官方yum源里无此四个包,所以选择epel yum源安装

[root@lnmp02 ~]# wget -O/etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo     ###安装epel yum源,此yum源于官方的不冲突,官方找不到需要的包时,才会从epel里找相应的包

[root@lnmp02 ~]# yum -y installlibmcrypt-devel mcrypt mhash mhash-devel

 

  1. 编译安装PHP

[root@lnmp02 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

[root@lnmp02 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方法:

[root@lnmp02 php-5.5.38]# ln -s/application/mysql/lib/libmysqlclient.so.18 /usr/lib64/

[root@lnmp02 php-5.5.38]# touchext/phar/phar.phar

或者

[root@lnmp02 php-5.5.38]# echo"/application/mysql/lib">>/etc/ld.so.conf

[root@lnmp02 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方法:

[root@lnmp02 php-5.5.38]# yum-y install libtool-ltdl-devel

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

[root@lnmp02 php-5.5.38]# makeinstall

[root@lnmp02 php-5.5.38]# ln -s/application/php5.3.27/ /application/php

 

  1. 配置php配置文件

[root@lnmp02 php-5.5.38]# cpphp.ini-production /application/php/lib/php.ini

[root@lnmp02 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见附件

[root@lnmp02 etc]# mkdir/app/logs -p  ###创建logs目录,php-fpm.conf文件里定义的日志路径

[root@lnmp02 etc]#/application/php/sbin/php-fpm      ###启动PHP服务

[root@lnmp02 etc]# ps -ef|grepphp                   ###查看php进程

[root@lnmp02 etc]# lsof -i:9000                ###通过端口号查看php进程是否起来

 

 


点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

举报

0/150
提交
取消