Apache不能解析php,和配置文件无关

做个记录


[root@vm-centos conf.d]# rpm -ql mod_php72w
/etc/httpd/conf.d/php.conf
/etc/httpd/conf.modules.d/10-php.conf
/usr/lib64/httpd/modules/libphp7-zts.so
/usr/lib64/httpd/modules/libphp7.so
/usr/share/httpd/icons/php.gif
/var/lib/php/session
/var/lib/php/wsdlcache
[root@vm-centos conf.d]# 
[root@vm-centos conf.d]# ls -l /usr/lib64/httpd/modules/*php*
ls: cannot access /usr/lib64/httpd/modules/*php*: No such file or directory
[root@vm-centos conf.d]# 
[root@vm-centos conf.d]# ls -l /etc/httpd/modules/*php*
ls: cannot access /etc/httpd/modules/*php*: No such file or directory

看起来mod_php安装的有问题,回想一下,我是先安装的nginx+php,在装php的时候把mod_php也同时安装了,后面才安装的apache。


卸载mod_php重新安装

[root@vm-centos conf.d]# yum remove mod_php
[root@vm-centos conf.d]# yum install mod_php

再次检查mod_php

[root@vm-centos conf.d]# ls -l /etc/httpd/modules/*php*
-rwxr-xr-x. 1 root root 5124456 Oct 12 03:27 /etc/httpd/modules/libphp7.so
-rwxr-xr-x. 1 root root 5313960 Oct 12 03:27 /etc/httpd/modules/libphp7-zts.so
[root@vm-centos conf.d]# 

测试apache已经可以解析php文件了。

你可能感兴趣的:(Apache不能解析php,和配置文件无关)