linux + apache 2.4.4 + php配置

來源:互聯網
上載者:User

1.下載httpd2.4.4,存放目錄:/home/aaron/httpd-2.4.4.tar.gz,解壓 tar -zxvf httpd-2.4.4.tar.gz

2.安裝

進入解壓後的/home/aaorn/httpd-2.4.4目錄,執行./configure --prefix=/home/aaron/httpd,提示:

checking for APR... configure: WARNING: APR version 1.4.0 or later is required, found 1.3.9
configure: WARNING: skipped APR at apr-1-config, version not acceptable
no
configure: error: APR not found.  Please read the documentation.

查看apache安裝文檔:http://httpd.apache.org/docs/2.4/install.html   需要新的apr,按照嚮導下載apr-1.4.6.tar.gz,apr-util-1.5.1.tar.gz,按照說明,分別解壓到:
httpd2.4.4/srclib/apr和httpd2.4.4/srclib/apr-util(絕對路徑省略),

tar -zxvf apr-1.4.5.tar.gz -C /home/aaron/httpd-2.4.4/srclib/

tar -zxvf  apr-util-1.5.1.tar.gz -C /home/aaron/httpd-2.4.4/srclib/

注意解壓後apr和apr-util目錄是帶版本號碼的,把目錄分別重新命名成apr和apr-util(不帶版本號碼)      mv apr-1.4.5 apr ,mv apr-util-1.5.1 apr-util

再到httpd-2.4.4目錄下./configure --prefix=/home/aaron/httpd --with-included-apr  

注意這一步,網上有很多人是把apr和apr-utils先編譯安裝,然後再用參數--with-apr=/xx/apr  --with-apr-util=/xx/apr-util/bin,我沒有測試,應該效果是一樣的

make && make install

執行成功!httpd安裝成功!

3.下載php-5.4.12.tar.gz,解壓到/home/aaron/php-5.4.12,進入解壓後的目錄

./configure --prefix=/home/aaron/php --with-apxs2=/home/aaron/httpd/bin/apxs --with-mysql

成功後:make && make install

執行成功,php安裝成功!

參考:http://www.php.net/manual/en/install.unix.apache2.php

cp php.ini-development /usr/local/lib/php.ini  //   /usr/local/lib需要有許可權,或者在安裝前指定ini檔案的目錄 --with-config-file-path=/some/path

4.修改httpd配置

添加:

<FilesMatch "\.ph(p[2-6]?|tml)$">
        SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>

注釋掉LoadModule中的rewrite_module

在上面的<FilesMathc/>後再添加:

RewriteEngine On
RewriteRule (.*\.php)s$ $1 [H=application/x-httpd-php-source]

5.配置完成,啟動httpd:./bin/apachectl start

checking for APR... configure: WARNING: APR version 1.4.0 or later is required, found 1.3.9
configure: WARNING: skipped APR at apr-1-config, version not acceptable
no
configure: error: APR not found.  Please read the documentation.
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.