1. 安裝環境:(cent6.5)
yum install -y php php-devel httpd php-fpm mysql
2. 修改配置文件
vim /etc/httpd/conf/http.conf
注釋掉DocumentRoot
vim /etc/httpd/conf.d/vhost.conf
<VirtualHost *:80>
ServerName www.aa.com
ProxyRequests OFF
DirectoryIndex index.php
DocumentRoot “/hypweb/”
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/hypweb/$1
<Directory “/hypweb/”>
Options None
AllowOverride None
</Directory>
</VirtualHost>
3.啟動httpd 和 php-fpm
ss -tnl
確認起來沒有問題
4. vim /hypweb/index.html
[u’192.168.100.101′]whentest
vim /hypweb/index.php
<?php
phpinfo();
?>
5 修改屬主:
chown -R apache:apache /hypweb/
6.重啟服務。
測試。。。
訪問index.php如下
日志報錯如下 tail /var/log/httpd/error.log
文字:
[Sun Apr 09 16:16:55 2017] [warn] proxy: No protocol handler was valid for the URL /index.php. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
但是 /var/log/php-fpm/error.log 除了啟動日志什么也沒有。
以下是進程信息。
以下是部分模塊信息。httpd -M
一下是一些版本信息。
我實在沒招了,希望老師們能幫幫忙。qq里我說了好多遍,也沒解決。沒法只好寫成博客,這樣便于觀看。
注釋掉ProxyPassMatch這條php頁面就能正常顯示。應該是調用了默認的php-module模式。但是我不想采用這種模式,我想用php-fpm模式
個人感覺,應該就是ProxyPassMatch這條語句沒有執行,或者執行有問題
好吧其實是版本問題。默認cent6安裝httd的版本是2.2 fcgi模塊要求2.4的版本。。要么編譯安裝,要么使用cent7
原創文章,作者:haoyp,如若轉載,請注明出處:http://www.www58058.com/73052
這個問題上周分享答疑會上幫你解決了哈~~歡迎在分享答疑會上提出問題~~