Seems that the web server is not handing off to PHP-FPM; what is your set up?
Sep 20, 2021
15
Level 5
php shown as plaintext (mac monterey)
I upgrade my Mac to the new version, after install I use homebrew to install PHP 8, but when run a project (Laravel) its shown as plain text
Level 104
@ethar in your /usr/local/etc/httpd/httpd.conf, you can load the PHP apache module and configure Apache to handle PHP files:
atom /usr/local/etc/httpd/httpd.conf
Add the following line to the end of the LoadModule list:
LoadModule php_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp.so
Then, in the same file, find the IfModule dir_module directive and add the FilesMatch directive after (like this):
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Restart the httpd service:
brew services restart httpd
Now check that the phpinfo() script from earlier replies is working.
1 like
Please or to participate in this conversation.