简体   繁体   中英

Apache 2.4 does not execute PHP

I have a problem with apache and PHP 5.4 running on a centOS 7 machine. Apache host have the directory index option:

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

The directory where apache points to contains a index.php. But when I navigate the browser to the related website, the browser only shows the php code.

I've already checked, if php is activated in http.conf - and it is. The application (zabbix) should work with this version of PHP and all necessary SQL- and PHP-plugins are installed.

No more Google suggestions for this problem - any of you an idea how to solve this?


Output of /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

    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. If so, make sure Apache was restarted after that:

sudo systemctl restart httpd

If that does not help, try reinstalling the PHP packages, then restarting Apache.

If that does not help, post the contents of /etc/httpd/conf.d/php.conf here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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