httpd.conf PHP module not found

15.2k Views Asked by At

I'm trying to set up PHP following the steps from https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions

I installed php brew install php71 --with-httpd24

But when I open the file /usr/local/etc/apache2/2.4/httpd.conf the php module is not there, I don't have any LoadModule php7_module

What am I missing? Thank you in advance!

1

There are 1 best solutions below

1
On

Most likely your Apache http server is not able to understand what the .php file is because the httpd.conf configuration file is not set to load php module. Make sure php installed yum install php

check the existence of php files

    $ ls /etc | grep php
    php.d 
    php.ini

The most important thing we need to check is that there is a php module

    $ ls /etc/httpd/modules/ | grep php
    libphp5.so

We need to add the following line somewhere in the /etc/httpd/conf/httpd.conf file. Find the place in the document where all the LoadModule commands are by entering /LoadModule and pressing enter, than add the line there.

LoadModule php5_module modules/libphp5.so

Restart apache

    $ apachectl restart