After using brew to install Apache version 2.4.46 on Mac OS Big Sur 11.2.3, and using brew to install PHP 8.0.6, I am unable to run PHP. I am running Apache from /usr/local/etc/httpd, and my Document Root is at /usr/local/var/www. I am not using the Apple supplied Apache.
Here is my phpinfo.php:
<?PHP phpinfo(); ?>
Here is my phpinfo.html:
<html>
<head>
<title>Testing PHP embedded in HTML</title>
</head>
<body>
<h1>Testing PHP embedded in HTML</h1>
<?php
phpinfo();
?>
</body>
</html>
Attempting to access https://myserver/phpinfo.php displays or downloads rather than executing the PHP code. Attempting to access https://myserver/phpinfo.html displays the Title and Heading but not the PHP result.
LoadModule mod_php does not appear (even commented out) in my httpd.conf file.
Everything else appears to work fine.
What do I need to do to enable PHP?