Centos7 PHP-FPM源码安装

PHP-FPM源码安装

安装必要组件

yum install -y openssl-devel traceroute libtool unzip gcc gcc-c++ autoconf net-snmp-devel vim wget sysstat lrzsz  man tree mysql-devel ntpdate rsync libxml2 libcurl libcurl-devel libxml2-devel zlib zlib-devel libjpeg* pcre-devel gd gd-devel bind-utils

 

下载PHP-FPM5.6

  http://museum.php.net/php5/ 这个网站地址涵盖了所有PHP版本包,我们选择对应包下载即可。

wget http://museum.php.net/php5/php-5.6.9.tar.gz

tar –zxvf php-5.6.9.tar.gz

cd php-5.6.9

 

编译安装

./configure  –prefix=/opt/php5.6 –with-config-file-path=/opt/php5.6/etc –with-iconv=/usr/local/libiconv \

 –enable-fpm –with-libxml-dir –with-zlib –with-curl –enable-dba –enable-ftp –with-freetype-dir –with-gd \

 –with-jpeg-dir –with-png-dir –with-zlib-dir –enable-gd-native-ttf –with-gettext –enable-mbstring –with-mcrypt \

 –with-mysql –with-mysqli –enable-pcntl –with-pdo-mysql –without-pdo-sqlite –enable-shmop –enable-sockets \

  –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-zip

编译时报configure: error: Please reinstall the iconv library.” 说明还缺少libiconv手工安装libiconv

wget  http://mirror.hust.edu.cn/gnu/libiconv/libiconv-1.10.tar.gz

tar zxvf libiconv-1.10.tar.gz

cd libiconv-1.10

./configure –prefix=/usr/local/libiconv

make 

make install

 

完成之后继续运行PHP"./configure …" ,结果又遇到报错:又遇到报错“configure: error: mcrypt.h not found. Please reinstall libmcrypt.” ,好像又缺少libmcrypt依赖,继续百度解决,看了几篇文章之后说要安装3个依赖,依次下载(#参考文章参考: http://blog.csdn.net/21aspnet/article/details/8203447

 

wget  http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

解压之后 ./configure   make    make install

 

wget  http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz

解压之后 ./configure   make    make install

 

wget  http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz

#运行./configure 报错 configure: error: *** libmcrypt was not found ,继续百度找到解决方法:”先运行 export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH,“

export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH

 ./configure  make    make install

 

安装完查看php-fpm是否安装成功

 [root@localhost ~]# /opt/php5.6/sbin/php-fpm -v

PHP 5.6.9 (fpm-fcgi) (built: Aug 16 2016 19:04:13)

Copyright (c) 1997-2015 The PHP Group

Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

 

启动php-fpm

# cd /opt/php5.6/etc

生成php-fpm配置文件

cp php-fpm.conf.default php-fpm.conf

 

[root@localhost etc]#

[root@localhost etc]# ps -ef|grep php-fpm

root     47882     1  0 13:28 ?        00:00:00 php-fpm: master process (/opt/php5.6/etc/php-fpm.conf)

nobody   47883 47882  0 13:28 ?        00:00:00 php-fpm: pool www

nobody   47884 47882  0 13:28 ?        00:00:00 php-fpm: pool www

root     47886 47840  0 13:29 pts/1    00:00:00 grep –color=auto php-fpm

[root@localhost etc]#

[root@localhost etc]# netstat -nat|grep 9000

tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN

 

 

Nginx启用php-fpm

Server{

         #

        location ~ \.php$ {

            root           html;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html/$fastcgi_script_name;

            include        fastcgi_params;

        }

}

 

[root@localhost etc]# nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

[root@localhost etc]# nginx -s reload

 

 

 

原创文章,作者:null,如若转载,请注明出处:http://www.178linux.com/43926

(3)
nullnull
上一篇 2016-09-06
下一篇 2016-09-06

相关推荐

  • 文件查找相关:whereis、find和locate

        本文将对find和locate进行详细讲解 命令简介 名称:whereis     功能:定位文件所在的目录     用法:whereis shell命令     注意:whereis是根据环境变量PATH来查找文件的,而PATH通常设置成存放命令的那些路径,如/bin、…

    Linux干货 2016-04-05
  • Centos 6.5下DNS服务器主从复制搭建及测试

    一、实验环境及IP地址规划     VMware Workstation 10.0, CentOS 6.5 X86系统     主DNS服务器:192.168.1.102     从DNS服务器:192.168.1.110     www服务器:  …

    Linux干货 2015-04-18
  • MySQL复制: Galera

    MySQL复制: Galera mysql 主从复制 前言 Galera Replication简介 MariaDB-Galera-Server 环境部署 配置步骤 总结 前言 之前介绍了MySQL复制的各种解决方案, 但是我个人还是感觉Galera最好用也最实用, 什么是Galera, 它强大在哪里, 这篇文章就带你认识这个强大的工具 Galer…

    Linux干货 2016-04-28
  • Linux下如何使用sendEmail来发送邮件

    1)什么是sendEmail sendEmail是一个轻量级,命令行的SMTP邮件客户端(注意,不要跟sendmail混淆了)。如果你需要使用命令行发送邮件,那么sendEmail是非常完美的选择:使用简单并且功能强大,从此以后你就爱上了它。 2)安装sendEmail [root@zabbix ~]# wget http://…

    系统运维 2016-07-29
  • Centos 7 快速进入图形界面

    Centos 7 快速进入图形界面.pdf

    系统运维 2016-04-05
  • 从“黑掉Github”学Web安全开发

    Egor Homakov(Twitter: @homakov 个人网站: EgorHomakov.com)是一个Web安全的布道士,他这两天把github给黑了,并给github报了5个安全方面的bug,他在他的这篇blog——《How I hacked Github again》(墙)说明了这5个安全bug以及他把github…

    Linux干货 2016-08-15