设为首页 收藏本站
查看: 595|回复: 0

[经验分享] 基于CentOS6.5环境之下的LNMP之编译安装PHP5.5.30

[复制链接]

尚未签到

发表于 2018-12-17 09:52:09 | 显示全部楼层 |阅读模式
  LNMP之编译安装PHP5.5.30
  1、编译前操作:
1.1、netstat -tulnp | egrep "80|3306"
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      25392/nginx         
tcp        0      0 :::3306                     :::*                        LISTEN      53278/mysqld1.2、yum install zlib libxml libjpeg libjpeg-devel freetype-devel libpng libpng-devel curl curl-devel libiconv zlib-devel libxml2-devel -y  

  #国际化本地化字符集转换软件包
1.3、wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar xf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libconv1.14
make && make install1.4、wget http://ncu.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
tar xf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/usr/local/libmcrypt2.5.8
make && make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make && make install1.5、wget http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
tar xf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure --prefix=/usr/local/mhash0.9.9.9
make && make install1.6、
ln -s /usr/local/libmcrypt2.5.8/lib/libmcrypt.la  /usr/lib/libmcrypt.la
ln -s /usr/local/libmcrypt2.5.8/lib/libmcrypt.so  /usr/lib/libmcrypt.so
ln -s /usr/local/libmcrypt2.5.8/lib/libmcrypt.so.4  /usr/lib/libmcrypt.so.4
ln -s /usr/local/libmcrypt2.5.8/lib/libmcrypt.so.4.4.8  /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/mhash0.9.9.9/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/mhash0.9.9.9/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/mhash0.9.9.9/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/mhash0.9.9.9/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/mhash0.9.9.9/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/libmcrypt2.5.8/bin/libmcrypt-config /usr/bin/libmcrypt-config
ln -s /usr/local/libmcrypt2.5.8/include/mcrypt.h /usr/local/include/mcrypt.h1.7、wget http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
tar xf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
/sbin/ldconfig
export LD_LIBRARY_PATH=/usr/local/libmcrypt2.5.8/lib:/usr/local/lib:/usr/local/mhash0.9.9.9/lib
export LDFLAGS="-L/usr/local/libmcrypt2.5.8/lib -I/usr/local/mhash0.9.9.9/include/"
export CFLAGS="-I/usr/local/mhash0.9.9.9/include/"
./configure --prefix=/usr/local/mcrypt2.6.8 --with-libmcrypt-prefix=/usr/local/libmcrypt2.5.8
make && make install  

  

  错误1、./configure错误及解决方案
*** Could not run libmcrypt test program, checking why...
*** The test program compiled, but did not run. This usually means
*** that the run-time linker is not finding LIBMCRYPT or finding the wrong
*** version of LIBMCRYPT. If it is not finding LIBMCRYPT, you'll need to set your
*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
*** to the installed location  Also, make sure you have run ldconfig if that
*** is required on your system
***
*** If you have an old version installed, it is best to remove it, although
*** you may also be able to get things to work by modifying LD_LIBRARY_PATH
***
configure: error: *** libmcrypt was not found
解决方法:
export LD_LIBRARY_PATH=/usr/local/libmcrypt2.5.8/lib:/usr/local/lib:/usr/local/mhash0.9.9.9/lib
export LDFLAGS="-L/usr/local/libmcrypt2.5.8/lib -I/usr/local/mhash0.9.9.9/include/"
export CFLAGS="-I/usr/local/mhash0.9.9.9/include/"  

  2编译安装及配置php
  2.1安装编译php5.5.30
wget http://cn2.php.net/distributions/php-5.5.30.tar.bz2
tar jxf php-5.5.30.tar.bz2
cd php-5.5.30
./configure --prefix=/usr/local/php5.5.30 --with-mysql=/usr/local/mysql5.6.27 --with-iconv-dir=/usr/local/libconv1.14 --enable-fpm --enable-sockets --enable-sysvsem --enable-mbstring --enable-pcntl --enable-gd-native-ttf --enable-zip --enable-shmop --enable-inline-optimization --enable-bcmath --enable-ftp  --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-openssl --with-mhash --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --with-xmlrpc --with-curl --with-xsl --with-fpm-user=nginx --with-fpm-group=nginx
ln -s /usr/local/mysql5.6.27/lib/libmysqlclient.so.18 /usr/lib
make && make install  

  错误2、./configure错误及解决方案:
configure: error: libmcrypt version 2.5.6 or greater required
解决方法:
rpm -ivh "http://mirrors.ustc.edu.cn/epel/6Server/x86_64/epel-release-6-8.noarch.rpm"
yum install -y  libmcrypt-devel  

  2.2、配置php参数:
cp /root/php-5.5.30/php.ini-production /usr/local/php5.5.30/lib/php.ini
cd /usr/local/php5.5.30/etc
cp php-fpm.conf.default php-fpm.conf
vim php-fpm.conf
#修改fastcgi的参数文件php-fpm.conf的相关选项值:
pid = /usr/local/php5.5.30/var/run/php-fpm.pid  
pm.max_children = 40
pm.start_servers = 3
pm.min_spare_servers = 3
pm.max_spare_servers = 8
/usr/local/php5.5.30/sbin/php-fpm -t
/usr/local/php5.5.30/sbin/php-fpm
netstat -tulnp | grep 9000  

  2.3修改ngnix的配置文件nginx.conf(/usr/local/nginx-1.8.0/conf/nginx.conf)
  在server标签的server_name下添加一行为(indexindex.php)的配置代码
        listen       80;
        server_name  www.fnw.com;
        index   index.php;  把server中的以下内容注释掉:
        #location / {
        #    root   html;
        #    index  index.html index.htm;
        #}  在server中添加以下内容
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            #fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx1.8/html/$fastcgi_script_name;
            include        fastcgi_params;
        }  

  
  如果nginx没有启动则执行:/usr/local/nginx-1.8.0/sbin/nginx
  若nginx服务器已经启动则执行:/usr/local/nginx-1.8.0/sbin/nginx -s reload
  

  3、测试nginx,php,mysql是否成功:
  3.1、测试php,ngnix是否配置成功
[root@fnw html]# cat >> index.php

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-652302-1-1.html 上篇帖子: PHP 魔术变量和魔术函数 下篇帖子: PHP 中修改xml节点数据的函数
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表