2

I'm on centos 7 and have the httpd service (2.4.6) installed from yum no problems and I had to install PHP from a different repo remi to get php 5.6 installed.

PHP works on the command line and the httpd service is running but all php is not being executed, there are no errors in any logs, and the below php.conf exists.

AddHandler php5-script .php
AddType text/html .php

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

I've been at this hours now going around in circles and just can't seem to see where the disconnect between apache and php is, any help greatly appreciated.

  • What happend when you try to display a php page, php source is displayed ? – Froggiz Nov 23 '15 at 20:52
  • @Froggiz, PHP code is displayed plain-text. – llanato Nov 23 '15 at 20:57
  • @llanato, create test.php with the following code <?php phpinfo(); ?> and put it in your Apache document root or anywahere that you can execute from a browser. Then see what happens when you go to page hostname_or_ip/test.php. This is a test to see if php is working with apache. – Diamant Nov 23 '15 at 21:32
  • @bangal, as I already said, php isn't working with apache at all, it's only working on the command line and all php code is displayed as plain-text. – llanato Nov 23 '15 at 21:36
  • @llanato, what does your /var/log/httpd/error_log says when you try to execute a php page? – Diamant Nov 23 '15 at 21:41
2

It seems your php module for apache is not working. It's may be not properly installed or configured.

To see all available modules, you can run:

apachectl -M

You can enable the module by adding the following line either in httpd.conf or your vhost config file:

LoadModule php5_module        modules/libphp5.so

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.