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.www58058.com/43926

(3)
nullnull
上一篇 2016-09-06 15:21
下一篇 2016-09-06 16:05

相關推薦

  • 文件系統的掛載使用總結

    文件系統使用 除根文件系統以外的文件系統創建后要使用需要先掛載至掛載點后才可以被訪問,掛載點即分區設備文件關聯的某個目錄文件,掛載命令mount和 卸載命令umount; 掛載點: mount_point,作為被掛載的文件系統的訪問入口; 作為掛載點需要滿足三個條件:  (1)這個目錄事先存在  (2)使用未被或不會被其他進程使用到的目錄…

    系統運維 2016-11-19
  • bash功能特性二 命令別名和歷史命令

    一、歷史命令     bash提供存儲歷史命令的功能,下面來詳細介紹一下。     1、history命令         命令格式:history [options]   &nb…

    Linux干貨 2015-04-21
  • 淺談Nginx(二)—http下server配置

    淺談Nginx(二)—http下server配置 此文介紹Nginx下的http模塊,著重介紹http模塊下的server服務 ——–依據”馬哥教育”主講人馬永亮導師的上課筆記整理——- 目錄  一. http相關的基本配置:     1)…

    系統運維 2017-02-07
  • LVS常見的類型實現方式

    前言  由于lvs的基礎知識已經在第一篇lvs中講解了,所以在這里只做實驗,包括lvs-nat,lvs-dr,以及基于Freiwall標記和實現會話綁定實驗。 一、lvs-nat:也是MASQERADING,簡稱為m(masquerading)    實驗圖:     地址規劃:     …

    Linux干貨 2015-06-29
  • LAMP+NFS實現雙web服務負載均衡

        一、實驗拓撲          二、系統環境      1、主機A、主機B、主機C:CentOS 6.5        測試PC:         Windows 7 旗艦…

    Linux干貨 2015-07-06
  • AOP面向方面編程

    1.引言         軟件開發的目標是要對世界的部分元素或者信息流建立模型,實現軟件系統的工程需要將系統分解成可以創建和管理的模塊。于是出現了以系統模塊化特性的面向對象程序設計技術。模塊化的面向對象編程極度極地提高了軟件系統的可讀性、復用性和可擴展性。向對象方法的焦點在于選擇對象作為模塊的主要單元,并將對象與系統的…

    Linux干貨 2015-04-07
欧美性久久久久