Apache 24 not serving PHP on FreeBSD 10
5,234
Try the next config:
LoadModule php5_module libexec/apache24/libphp5.so
<IfModule php5_module>
<FilesMatch "\.(php|phps|php5|phtml)$">
SetHandler php5-script
</FilesMatch>
DirectoryIndex index.php
</IfModule>
<IfModule mime_module>
...
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .php
...
</IfModule>
I hope this help.
Related videos on Youtube
Author by
SteveMustafa
Updated on September 18, 2022Comments
-
SteveMustafa almost 2 years
I've been at this for a few hours now. I cannot figure out WHAT is wrong with my configuration. When I navigate to any php file (wordpress installation is the intent), it opens the file for download rather then rendering/serving it.
I built (in order) Apache24, PHP55, PHP55-extensions, mod_php5.
I added the following to httpd.conf
LoadModule php5_module libexec/apache24/libphp5.so LoadModule rewrite_module libexec/apache24/mod_rewrite.so
and I also added index.php like so:
<IfModule dir_module> DirectoryIndex index.php index.html </IfModule> <IfModule mod_php5.c> DirectoryIndex index.php index.html index.htm AddType application/x-httpd-php .php </IfModule>
When Apache starts, it starts without any errors or warnings and this is my entire error log:
[Sat Nov 22 10:28:53.125634 2014] [core:notice] [pid 17892] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT' [Sat Nov 22 10:43:03.724529 2014] [mpm_prefork:notice] [pid 17892] AH00169: caught SIGTERM, shutting down [Sat Nov 22 10:43:03.883893 2014] [mpm_prefork:notice] [pid 17995] AH00163: Apache/2.4.10 (FreeBSD) PHP/5.5.19 configured -- resuming normal operations [Sat Nov 22 10:43:03.883968 2014] [core:notice] [pid 17995] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT' [Sat Nov 22 11:15:53.541441 2014] [mpm_prefork:notice] [pid 17995] AH00169: caught SIGTERM, shutting down [Sat Nov 22 11:15:53.746420 2014] [mpm_prefork:notice] [pid 14477] AH00163: Apache/2.4.10 (FreeBSD) PHP/5.5.19 configured -- resuming normal operations [Sat Nov 22 11:15:53.746504 2014] [core:notice] [pid 14477] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'
I've built, configured and reinstalled this multiple times now and I still can't figure out how to make it work.
If there is something else I can post to help, please let me know.
-
SteveMustafa over 9 yearsI just tried that, same result.
-
SteveMustafa over 9 years@FredericoSierra That worked! Thank you! Now a few more follow up questions. 1) Would you please explain why it worked? 2) Why on earth would the installation/setup be so difficult on FreeBSD?
-
Federico Sierra over 9 years@SteveMustafa I'm no expert about FreeBSD, but you must add the new mime type in
<IfModule mime_module>
section. SetHandler directive forces all matching files to be processed by a handler, in this case php module. See also forums.freebsd.org/threads/is-freebsd-difficult-to-learn.41656 -
SteveMustafa over 9 years@FredericoSierra Thank you very much, that helped.