简体   繁体   English

Apache 2.4不执行PHP

[英]Apache 2.4 does not execute PHP

I have a problem with apache and PHP 5.4 running on a centOS 7 machine. 我在centOS 7计算机上运行apache和PHP 5.4时遇到问题。 Apache host have the directory index option: Apache主机具有目录索引选项:

<Directory my/directory>
Options Indexes
</Directory>

The directory where apache points to contains a index.php. apache指向的目录包含index.php。 But when I navigate the browser to the related website, the browser only shows the php code. 但是,当我将浏览器导航到相关网站时,浏览器仅显示php代码。

I've already checked, if php is activated in http.conf - and it is. 我已经检查了是否在http.conf中激活了php-确实如此。 The application (zabbix) should work with this version of PHP and all necessary SQL- and PHP-plugins are installed. 该应用程序(zabbix)应与此版本的PHP一起使用,并已安装所有必需的SQL和PHP插件。

No more Google suggestions for this problem - any of you an idea how to solve this? Google不再提供有关此问题的建议-你们中有人知道如何解决这个问题?


Output of /etc/http/conf.d/php.conf: /etc/http/conf.d/php.conf的输出:

<FilesMatch \.php$>
    SetHandler application/x-httpd-php 
</FilesMatch>

AddType text/html .php

DirectoryIndex index.php

#<FilesMatch \.phps$>
#    SetHandler application/x-httpd-php-source
#</FilesMatch>

php_value session.save_handler "files"
php_value session.save_path    "/var/lib/php/session"

Please check below thinks in your httpd config file 请在您的httpd配置文件中检查以下内容

    LoadFile "D:/wamp/php/libpq.dll"  // Your sepcified path
    LoadModule php5_module "D:/wamp/php/php5apache2_4.dll" // Your sepcified path
    AddType application/x-httpd-php .php    // Your sepcified path 
    PHPIniDir "D:/wamp/php" // Your sepcified path

You probably installed PHP from the distribution packages. 您可能是从分发包中安装了PHP。 If so, make sure Apache was restarted after that: 如果是这样,请确保在此之后重新启动Apache:

sudo systemctl restart httpd

If that does not help, try reinstalling the PHP packages, then restarting Apache. 如果那没有帮助,请尝试重新安装PHP软件包,然后重新启动Apache。

If that does not help, post the contents of /etc/httpd/conf.d/php.conf here. 如果那没有帮助,请在此处发布/etc/httpd/conf.d/php.conf的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM