MacOS – PHP not running after upgrading to Catalina

catalinamacosPHP

I've followed all the tutorials, updated httpd.conf and other files. Apache works fine but PHP does not seem enabled. Pointing to php_info.php =>

<?php phpinfo() ?>

I formerly ran High Sierra with no problems with apache and php. Upgrading to Catalina evidently broke that. PHP is not enabled though the module line is uncommented in httpd.conf. Nothing in the setup indicates PHP is not running but when I point a browser to a PHP file, it does not process the page but just displays the code – as mentioned php_info.php does not show the info page, just the php code.

This is the apache/php installation that came with Catalina.

Apache error log:

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Tobys-iMac.local. Set the 'ServerName' directive globally to suppress this message

[Wed Jan 08 22:05:26.428368 2020] [mpm_prefork:notice] [pid 159] AH00163: Apache/2.4.41 (Unix) PHP/7.3.9 configured -- resuming normal operations

[Wed Jan 08 22:05:26.428420 2020] [core:notice] [pid 159] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

[Wed Jan 08 22:09:52.550744 2020] [mpm_prefork:notice] [pid 159] AH00169: caught SIGTERM, shutting down

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Tobys-iMac.local. Set the 'ServerName' directive globally to suppress this message

[Wed Jan 08 22:10:48.678248 2020] [mpm_prefork:notice] [pid 159] AH00163: Apache/2.4.41 (Unix) PHP/7.3.9 configured -- resuming normal operations

[Wed Jan 08 22:10:48.678307 2020] [core:notice] [pid 159] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

Access log:

::1 - - [09/Jan/2020:11:06:05 -0800] "GET /php_info.php HTTP/1.1" 200 18

::1 - - [09/Jan/2020:11:07:47 -0800] "GET /php_info.php HTTP/1.1" 200 18

::1 - - [09/Jan/2020:11:08:37 -0800] "GET /index.php HTTP/1.1" 304 -

::1 - - [09/Jan/2020:11:08:39 -0800] "GET /index.php HTTP/1.1" 200 16


::1 - - [09/Jan/2020:11:09:51 -0800] "GET /ePub%20Processing/process_toc-content.php HTTP/1.1" 200 7653

Best Answer

Found an answer that worked:

# added this to made php render
<IfModule php7_module>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

    <IfModule dir_module>
        DirectoryIndex index.html index.php
    </IfModule>
</IfModule>