CentOS編譯安裝php5.5,并配制支持apach,nignx核心代碼

首先是編譯準(zhǔn)備工作:

云城網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián)公司,云城網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為云城1000+提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)營銷網(wǎng)站建設(shè)要多少錢,請找那個(gè)售后服務(wù)好的云城做網(wǎng)站的公司定做!

yum groupinstall "Development tools"

然后是編譯安裝 PHP 5.5.x 需要用到的 devel 包:

yum install libxml2-devel gd-devel libmcrypt-devel libcurl-devel openssl-devel

從官方下載,解壓:

wget http://us3.php.net/get/php-5.5.5.tar.gz/from/cn2.php.net/mirror
tar -xvf php-5.5.5.tar.gz
cd php-5.5.5

編譯安裝 php 5.5 的參數(shù):

./configure --with-apxs2=/usr/local/apache2/bin/apxs --disable-cli --enable-shared --with-libxml-dir --with-gd --with-openssl --enable-mbstring --with-mcrypt --with-MySQLi --with-mysql --enable-opcache --enable-mysqlnd --enable-zip --with-zlib-dir --with-pdo-mysql --with-jpeg-dir --with-freetype-dir --with-curl --without-pdo-sqlite --without-sqlite3

我已經(jīng)盡量的在參數(shù)上做了精簡,用以上參數(shù)編譯安裝好的 php 運(yùn)行 wordpress, joomla, ip board 等常見的博客、論壇程序都是沒有問題的,因?yàn)橛辛?--disable-cli,所以就沒法 make test 了,安裝好以后也沒法 php -v 了。安裝吧:

make
make install
cp php.ini-production /usr/local/lib/php.ini
#記住上面 php.ini 的位置哦。

如是apache, 配制 apache 

是時(shí)候讓 apache 知道有 php 的存在了,在 apache 配置文件 httpd.conf 中添加:

LoadModule php5_module modules/libphp5.so
#上面那行可能在編譯安裝 php 的過程中已經(jīng)由系統(tǒng)自動添加了
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

OK!重啟 apache,人品好的人是不會出現(xiàn)問題的。

如是nignx, 配制 nignx

cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.confbak 
#備份原有配置文件
vi /etc/nginx/conf.d/default.conf 
#編輯

index index.php index.html index.htm; #增加index.php

# 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 $document_root$fastcgi_script_name;
include fastcgi_params;
}

#取消FastCGI server部分location的注釋,并要注意fastcgi_param行的參數(shù),改為$document_root$fastcgi_script_name,或者使用絕對路徑
service nginx restart #重啟nginx

本文題目:CentOS編譯安裝php5.5,并配制支持apach,nignx核心代碼
當(dāng)前網(wǎng)址:http://bm7419.com/article0/geieio.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站排名、網(wǎng)站策劃、動態(tài)網(wǎng)站、移動網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)