How to configure Apache to run PHP on OSX

By | November 8, 2020

Navigate to: /etc/apache2/httpd.conf and search for php. You should see:

#LoadModule php7_module libexec/apache2/

Remove the # which is uncommenting that line. Save the file and then restart Apache with the command:

sudo apachectl restart

As a quick test, if you place a small php file in your web server directory (/Library/WebServer/Documents/) you should be able to run it.

 echo "Hello, world!";

The other option is to run the command:

php test.php
Category: OSX

Leave a Reply

Your email address will not be published. Required fields are marked *