1

I've installed the following:

[root@localhost conf.d]# yum list installed | grep 'http'
httpd.x86_64                     2.4.6-80.el7.centos.1          @updates
httpd-tools.x86_64               2.4.6-80.el7.centos.1          @updates
[root@localhost conf.d]# yum list installed | grep 'php'
php72.x86_64                     1.0-1.el7.remi                 @remi-safe
php72-php-cli.x86_64             7.2.11-1.el7.remi              @remi-safe
php72-php-common.x86_64          7.2.11-1.el7.remi              @remi-safe
php72-php-json.x86_64            7.2.11-1.el7.remi              @remi-safe
php72-runtime.x86_64             1.0-1.el7.remi                 @remi-safe

PHP works fine already via CLI

[root@localhost conf.d]# php -v
PHP 7.2.11 (cli) (built: Oct 10 2018 08:49:35) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Apache also works fine

[root@localhost modules]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Jun 27 2018 13:48:59

My issues is Apache doesn't execute PHP and just triggers a download of the PHP file in the browser.

Note: This is on Vagrant running centos/7 box.

Any ideas?

  • Are you loading PHP in httpd.conf? For example on Windows LoadModule php5_module "c:/wamp/bin/php/php5.5.12/php5apache2_4.dll" – DavidPostill Oct 28 '18 at 21:05
  • I don't see that line. Actually ls /etc/httpd/modules/ doesn't show anything about PHP. It seems there was no PHP module installed for Apache. Any ideas how to install it? – IMB Oct 28 '18 at 21:08
  • Not really. I use Windows not Linux. And installed WAMP for convenience. – DavidPostill Oct 28 '18 at 21:25
  • @IMB did you found any solution for this problem i have similar problem like this please help if you have solved this issue – Dexter Mar 27 '19 at 9:38
  • @MohitJain see my answer below – IMB Mar 29 '19 at 8:49
6

For those who care, apparently the default php72 don't install the mod_php.

php72-php should be used instead.

So I just simply reinstalled PHP using php72-php instead of php72 and restarted Apache.

(answer found from https://serverfault.com/a/728663/75899)

| improve this answer | |

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.