Unable to get php working in apache
ryandesign at macports.org
Wed Mar 23 22:50:53 PDT 2011
On Mar 23, 2011, at 23:21, sdrulea wrote:
> I followed the straightforward install instructions here: https://trac.macports.org/wiki/howto/MAMP
> I’m able to start Apache up. However, PHP script in index.html isn’t interpreted. I’ve double checked my httpd.conf.
> I’ve attached my /opt/local/apache2/conf/httpd.conf for reference.
> The Apache error log reveals nothing:
> [Wed Mar 23 21:09:53 2011] [notice] Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/1.0.0d DAV/2 PHP/5.3.5 configured -- resuming normal operations
> Any ideas how to debug why mod_php isn’t working?
Looks like mod_php is working fine -- it's just designed to process .php files, not .html files. Rename your file from index.html to index.php.
If you really want to process PHP code in .html files, you can modify your Apache configuration to do so. However I strongly recommend not doing that; it probably has performance penalties, since now every .html file, even those containing no PHP code, will need to go through mod_php. Doing so might also disable caching for those pages, which would slow things down further and increase bandwidth usage.
More information about the macports-users