centos apache php 安裝

來源:互聯網
上載者:User

標籤:des   style   blog   http   color   io   os   使用   ar   

1.下載

wget http://apache.fayea.com/apache-mirror//httpd/httpd-2.2.29.tar.gz
tar zxvf httpd-2.2.29.tar.gz
cd httpd-2.2.29
./configure --prefix=/usr/local/httpd (你也可以指定自己的路徑)
make && make install
 
啟動apache 

/usr/local/httpd/bin/apachectl start

註冊為服務

cp /usr/local/httpd/bin/apachectl  /etc/rc.d/init.d/httpd

ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S61httpd

這樣就可以使用sevice httpd 來管理了

2.修改指令碼使其支援chkconfig

編輯httpd指令碼,在第2行添加如下注釋資訊:

# chkconfig: 35 61 61

# description: Apache

儲存後執行:chkconfig --add httpd

第一行的3個參數意義分別為:在哪些運行層級啟動httpd(3,5);啟動序號(S61);關閉序號(K61)。注意:以上兩行缺一不可

執行chkconfig --add httpd後就在rc3.d、rc5.d路徑中將來就會出現S61httpd的連結,其他運行層級路徑中會出現K61httpd的連結

2.php安裝

wget http://cn2.php.net/get/php-5.3.29.tar.gz/from/this/mirrortar zxvf phpcd phpyum install gd*./configure --prefix=/usr/local/php --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-apxs2=/usr/local/httpd/bin/apxs --with-gd --enable-mbstring
 
make && make install
cd /usr/local/php
cp /usr/local/src/php-5.3.29/php.ini-development ./lib/php.ini
 
apache的設定檔 311行左左右
AddType application/x-httpd-php .php .phtml
 
加上預設的index.php

centos apache php 安裝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.