php-5.5.27安裝

來源:互聯網
上載者:User

1.tar –zxvf php-5.5.27.tar.gz

cd php-5.5.27

 ./configure --prefix=/usr/local/php  --with-apxs2=/usr/local/httpd/bin/apxs 

  make

  make test

  make install

安裝完成後,要測試apache httpd是否對php支援。

建立 /usr/local/httpd/htdocs/index.php

編輯並添加如下內如到檔案

///////////////// index.php中添加的內容///////////

<?

Phpinfo()

?>

///////////////// 儲存退出///////////

 

訪問http://10.215.80.54/index/php,如果訪問成功,則網頁會顯示有關php的資訊,否則訪問失敗。

訪問失敗表示apache對php不支援,需要做如下修改:

1:find到libphp5.so,將其拷貝到 /usr/local/apache2/modules/ 目錄下

2:開啟 /usr/local/httpd/conf/httpd.conf檔案,並添如下資訊到其中

///////////////////httpd.conf檔案新增內容///////////////////

<FilesMatch "\.php$">

  SetHandler application/x-httpd-php

</FilesMatch>

 

<FilesMatch "\.ph(p[2-6]?|tml)$">

  SetHandler application/x-httpd-php

</FilesMatch>

 

<FilesMatch "\.phps$">

  SetHandler application/x-httpd-php-source

</FilesMatch>

 

LoadModule php5_module modules/libphp5.so

 

<ifModule dir_module>

   DirectoryIndex index.html index.php

</ifModule>

///////////////////儲存退出///////////////////

 

重啟apache :/usr/local/httpd/bin/apachectl restart             

重新訪問並測試是否成功

2.報錯:

1>configure: error: xml2-config not found. Please check your libxml2 installation

解決:

重新安裝libxml2和libxml2-devel包

yum install libxml2

yum install libxml2-devel -y

2>(xml_parse*() goes into infinite loop when autodetection in effect), using U

make test時報錯     忽略

聯繫我們

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