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 15:23
下一篇 2016-09-06 16:05

相关推荐

  • corosync + pacemaker + iscsi实现高可用mysql (上)

    一、实验图   二、准备实验环境:  1)确保sql服务器之间可以基于主机名通信 [root@SQL1 ~]# vim /etc/hosts 172.16.2.13  SQL1.linux.com  SQL1 172.16.2.14  SQL2.li…

    Linux干货 2015-07-09
  • 常见文件管理命令及bash特性

    cat:查看文件文本内容  -n:显示行号  [root@study ~]# cat -n /etc/passwd  1  root:x:0:0:root:/root:/bin/bash  2  bin:x:1:1:bin:/bin:/sb…

    系统运维 2016-11-06
  • 文件系统的挂载使用总结

    文件系统使用 除根文件系统以外的文件系统创建后要使用需要先挂载至挂载点后才可以被访问,挂载点即分区设备文件关联的某个目录文件,挂载命令mount和 卸载命令umount; 挂载点: mount_point,作为被挂载的文件系统的访问入口; 作为挂载点需要满足三个条件:  (1)这个目录事先存在  (2)使用未被或不会被其他进程使用到的目录…

    系统运维 2016-11-19
  • CentOS 6.5下编译安装httpd+mysql+php过程实录

    一、安装环境     Linux系统:CentOS 6.5     Apache版本:http-2.4.12     MySQL版本:MySQL 5.6.24     PHP版本:PHP-5.6.8 …

    Linux干货 2015-05-18
  • linux多网卡绑定

    为了增加网络牢固性,linux服务器通过多块网卡来实现网卡冗余或链路聚合、负载均衡的技术。网卡绑定mode共有七种(0~6) bond0、bond1、bond2、bond3、bond4、bond5、bond6常用的有三种mode=0:平衡负载模式,有自动备援,但需要”Switch”支援及设定。mode=1:自动备援模式,其中一条线若断线,其他线路将会自动备援…

    系统运维 2016-06-23
  • Linux基于PXE实现系统全自动无人值守安装

    前言 在生产环境中,我们时常会需要在多台客户端主机或服务器安装操作系统,如果每一台都去手动安装,费时费力,显然是不现实的。那么,如何高效的完成此类工作呢?文将讲解如何实现Linux系统的全自动无人值守安装。 提供PXE服务所需安装包 dhcp:动态主机配置协议,给客户端提供ip地址 tftp-server:tftp服务器端,提供系统安装所需文件 xinetd…

    Linux干货 2015-04-01