Unable to get php working in apache

sdrulea sdrulea at cisco.com
Thu Mar 24 09:37:26 PDT 2011


You're absolutely correct! I moved the <?php ..?> script into index.php and
it works fine.

I understand the performance cost associated with processing PHP in .html
files. Nevertheless, if I wanted to enable PHP in .html files, what would I
need to do?


On 3/23/11 10:50 PM, "Ryan Schmidt" <ryandesign at macports.org> wrote:

> 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 mailing list