在Centos 7上,我已经安装了HTTPD和PHP5.4(我知道它很旧,但是我使用的软件包需要PHP 5.4)
[root@devserver sites-enabled]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@devserver sites-enabled]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Jun 27 2018 13:48:59
[root@devserver sites-enabled]# php -v
PHP 5.4.16 (cli) (built: Apr 12 2018 19:02:01)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
Apache运行正常并显示php5已加载:
[root@devserver sites-enabled]# httpd -M | grep php
php5_module (shared)
我已设置httpd.conf通过10-php.conf加载模块
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
[root@devserver modules]# ls /etc/httpd/modules/ |grep php
libphp5.so
但是,当我尝试加载基本的phpinfo页面时,我只会看到
<?php
phpinfo();
?>
代替http处理php。 /var/www/html/error.log和/etc/httpd/logs/error.log都是干净的。实际上,它们完全是空的。
任何人都知道会发生什么事吗?