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
下一篇 2016-09-06

相關推薦

  • Linux bash編程基礎語法總結

    前言 在Linux學習過程中,我們無可避免的會碰到一個既讓人喜歡,又令人頭疼的神奇的東西——bash編程,即shell腳本。那么什么是shell腳本呢?shell是一個命令語言解釋器,而shell腳本則是Linux命令的集合,按照預設的順序依次解釋執行,來完成特定的、較復雜的系統管理任務,類似于Windows中的批處理文件。本文帶來的是bash編程的基礎語法…

    Linux干貨 2015-04-04
  • 設計模式(八)裝飾器模式Decorator(結構型)

    1. 概述        若你從事過面向對象開發,實現給一個類或對象增加行為,使用繼承機制,這是所有面向對象語言的一個基本特性。如果已經存在的一個類缺少某些方法,或者須要給方法添加更多的功能(魅力),你也許會僅僅繼承這個類來產生一個新類—這建立在額外的代碼上。       通過繼…

    Linux干貨 2015-07-03
  • SUID_SGID_Sticky簡單總結

    參考: http://blog.chinaunix.net/uid-25314474-id-3313109.html —————————————權限——&#82…

    Linux干貨 2015-09-14
  • 推薦-File System manager

    文件系統(File system) :     文件系統概要    文件系統的分類    文件系統的管理工具             mkfs btrfs ext xfs&nbsp…

    Linux干貨 2016-03-26
  • php 設計模式-數據映射模式(應用程序與數據庫交互模式)

    前面提到的設計模式大大提高了代碼的可讀性與可維護性。然而,在WEB應用設計與開發中一個基本的需求與挑戰:數據庫應用,這些設計模式都沒有涉及到。數據映射模式使您能更好的組織你的應用程序與數據庫進行交互。 下面我將用實際代碼說明,如果一個表發生變動。我們要修改客戶端代碼就可以了。特別是游戲項目,需求經常可能會經常變動。修改表結構,可能引起大片代碼的改動。 首先我…

    Linux干貨 2015-04-07
  • Linux用戶和組管理

        登錄Linux時我們都需要輸入賬號和密碼,但Linux只會識別賬號所對應用ID號,這個ID號就稱為UID。     同理每個用戶組也都擁有相對應的組ID號,即GID。     Linux根據/etc/passwd文件的內容來查找當前…

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