日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
lnmp環(huán)境安裝(4)-php源碼編譯安裝-創(chuàng)新互聯(lián)

本人安裝的lnmp環(huán)境的相關(guān)文件,可以在本人提供的百度云盤資源進(jìn)行下載

鏈接: http://pan.baidu.com/s/1dD6QZ1B 密碼: zcs8


一、概述

 php全稱PHP:Hypertext Preprocessor超文本處理器,開源腳本語言!

 其與web server的接口支持三種形式,分別為cgi, module方式, fastcgi方式。而對于nginx而言,只支持cgi和fastcgi兩種接口方式與php進(jìn)行連接!

我們提供的服務(wù)有:網(wǎng)站設(shè)計(jì)、網(wǎng)站制作、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、山陰ssl等。為數(shù)千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的山陰網(wǎng)站制作公司

 本節(jié)將以源碼安裝php,啟動(dòng)php-fpm服務(wù)(fastcgi接口)與nginx進(jìn)行連接。

 關(guān)于nginx的配置請看前面章節(jié)的有關(guān)介紹!

二、準(zhǔn)備工作

 1、安裝依賴開發(fā)包

 # yum install -y libxml2-devel bzip2-devel libcurl-devel libmcrypt-devel

 2、×××

 地址:http://php.net/downloads.php 下載所需版本,這里使用php-5.5.27.tar.bz2。

 也可以使用我的安裝文件,已存在百度云盤->請看文章開頭。

三、安裝配置

 1、配置

  --prefix                 指定安裝目錄

  --with-mysql=MYSQL_DIR        安裝mysql模塊 指定其安裝路徑

  --with-openssl            安裝openssl模塊

  --enable-fpm              支持fpm,對于采用fastcgi方式,此模塊必須開啟

  --enable-sockets           支持socket,對于采用fastcgi方式,此模塊必須開啟

  --enable-sysvshm             支持System V shared memory

  --with-mysqli=MYSQL_CONFIG_PATH     安裝mysqli模塊

  --with-config-file=CONFIG_DIR      指定php配置文件安裝路徑

  --with-config-file-scan-dir=CONFIG_DIR  指定配置文件的掃描路徑,就是除主配置文件php.ini的其他配置文件路徑

  --with-mysqlnd=share,mysqlnd       支持mysqlnd

  --with-enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-libxml-dir ...

  安裝php相關(guān)的一些擴(kuò)展文件

  配置如下

  # ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --enable-fpm --enable-sockets --enable-sysvshm --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-libxml-dir=/usr --enable-xml  --with-mhash --with-mcrypt  --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --with-curl --with-mysql=share,mysqlnd

 2、編譯安裝

  # make

  # make install

 3、準(zhǔn)備配置文件

  # cp php.ini-production /etc/php.ini

 4、開機(jī)啟動(dòng)php-fpm

  配置sysv啟動(dòng)腳本,添加到服務(wù)列表

  # cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm

  # chmod +x /etc/rc.d/init.d/php-fpm

  # chkconfig --add php-fpm

  # chkconfig php on

 5、添加php-fpm服務(wù)配置腳本

  # cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

 6、啟動(dòng)服務(wù)

  # service php-fpm start

  # ps -ef | grep php-fpm     // 可以看到系統(tǒng)已啟動(dòng)多個(gè)php-fpm進(jìn)程,說明php-fpm服務(wù)已啟動(dòng)成功

四、php-fpm和nginx

 1、編輯nginx.conf

  server段配置修改如下,為nginx添加腳本解析功能

  location / {

    root  html;

    index  index.html index.htm index.php;

  }

  #error_page  404        /404.html;

  # redirect server error pages to the static page /50x.html

  #

  error_page  500 502 503 504  /50x.html;

  location = /50x.html {

    root  html;

  }

  # proxy the PHP scripts to Apache listening on 127.0.0.1:80

  #

  #location ~ \.php$ {

  #   proxy_pass  http://127.0.0.1;

  #}

  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

  #

  location ~ \.php$ {

    root      html;

    fastcgi_pass  127.0.0.1:9000;

    fastcgi_index  index.php;

    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

    include     fastcgi_params;

  }

 2、修改/etc/nginx/fastcgi_params

  fastcgi_param  QUERY_STRING    $query_string;

  fastcgi_param  REQUEST_METHOD   $request_method;

  fastcgi_param  CONTENT_TYPE    $content_type;

  fastcgi_param  CONTENT_LENGTH   $content_length;

  fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;

  fastcgi_param  SCRIPT_NAME    $fastcgi_script_name;

  fastcgi_param  REQUEST_URI    $request_uri;

  fastcgi_param  DOCUMENT_URI    $document_uri;

  fastcgi_param  DOCUMENT_ROOT    $document_root;

  ... ...

重新定義fastcgi_param參數(shù)SCRIPT_FILENAME

 3、nginx重啟

  # service nginx restart

 4、測試訪問

  添加編輯/usr/local/nginx/index.php

  

   phpinfo();

  ?>

  瀏覽器訪問 http://域名/index.php,如下圖

  lnmp環(huán)境安裝(4)-php源碼編譯安裝

  綜合以上,完成php的安裝,啟用php-fpm服務(wù)器并與nginx進(jìn)行整合,測試完成!

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。


網(wǎng)頁題目:lnmp環(huán)境安裝(4)-php源碼編譯安裝-創(chuàng)新互聯(lián)
文章路徑:http://www.dlmjj.cn/article/disjcg.html