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

相关推荐

  • 推荐-HA专题: 编译安装并配置DRBD

    HA专题: 编译安装并配置DRBD 前言 实验环境 DRBD介绍 安装前准备工作 获取并编译安装DRBD 配置DRBD 分区 配置文件 启动并设置DRBD 格式化并挂载 验证冗余性 总结 前言 上篇我们讲到使用corosync+pacemaker实现MySQL高可用, 但是NFS容易成为单点故障从而导致数据丢失等严重问题, 我们可以使用drbd来实现MySQ…

    Linux干货 2016-04-12
  • HA专题: 使用pacemaker+corosync实现MySQL高可用

    HA专题: 使用pacemaker+corosync实现MySQL高可用 前言 实验拓扑 实验环境 实验步骤 准备工作 安装HA组件并配置 配置NFS 配置MySQL 配置HA资源 测试 总结 前言 上篇文章我们介绍了使用pacemkaer+corosync实现简单的nginx高可用, 这篇文章我们介绍如何使用pacemaker+corosync实现MySQ…

    Linux干货 2016-04-11
  • RAID详解

    测试机centos6.7 x86_64 一、RAID是什么     简单描述:RAID(Redundant Array of indenpensive Disk)独立磁盘冗余阵列:磁盘阵列是把多个磁盘组成一个阵列,当作单一磁盘使用,它将数据以分段或条带(striping)的方式储存在不同的磁盘中,存取数据时,阵列中的相关磁盘一起…

    2016-02-14
  • btrfs文件系统及管理

      什么是btrfs? Btrfs(B-tree文件系统,通常念成Butter FS,Better FS或B-tree FS),linux文件系统,具有写时复制COW(copy-on-write),改善ext3文件系统单文件大小限制,并加入其他特性,如可写快照,快照的快照,内建RAID,子卷(subvloume),专注于容错,修复和易于管理。单文件…

    系统运维 2016-05-13
  • 谷歌三大核心技术(一)The Google File System中文版

    摘要 我们设计并实现了Google GFS文件系统,一个面向大规模数据密集型应用的、可伸缩的分布式文件系统。GFS虽然运行在廉价的普遍硬件设备上,但是它依然了提供灾难冗余的能力,为大量客户机提供了高性能的服务。 虽然GFS的设计目标与许多传统的分布式文件系统有很多相同之处,但是,我们的设计还是以我们对自己的应用的负载情况和技术环境的分析为基础的,不管现在还是…

    Linux干货 2015-04-13
  • grep的基本用法详解

     grep是linux上常用的一个文本处理工具之一。它有着强大的文本处理能力,学会它,可以让工作更有效率。 一、初识grep   grep: Global search Regular Experssion and Print out line   从名字上也可以直观的了解到它是基于正则表达式进行全局搜索,并把结果打印到屏幕上来…

    系统运维 2015-05-25