Search code examples
phpapachelocalhostmacos-high-sierra

Apache server not using php despite installing it


I am setting up a local environment with php and an Apache server on my macOs High Sierra 10.13. Strangely, my Apache server won't read php files despite following various tutorials on how to set it up.

I have been installing php 7 with homebrew.

When I run php -S localhost:8000 I get the following info:

PHP 7.1.7 Development Server started at Wed Oct 11 18:47:39 2017
Listening on http://localhost:8000
Document root is /Users/username/Sites
Press Ctrl-C to quit.

So I guess my php version is correctly installed with my local server. apachectl configtest gives me:

Syntax ok

and httpd -v

Server version: Apache/2.4.27 (Unix)
Server built:   Jul 15 2017 15:41:46

Can someone here help me??


Solution

  • Alright I found what wasn't correct.

    I needed to insert AddType application/x-httpd-php .php in my httpd.conf file to enable MIME PHP.

    I hope this will help other people with similar issues in the future.