View Full Version : [ubuntu] Parsing html as php

April 13th, 2009, 04:43 AM

I just installed apache and php5 on my computer and everything seems to be working fine except that I want my html files to be parsed as php.

All my html files are kept in the directory /var/www, I have kept a file .htaccess in the same directory and added the following line

AddHandler x-httpd-php5 .html .htm .php .php5

but the html file is not getting parsed as php. Could someone tell what is the problem. Do i need to write something else in the .htaccess file. Or am I supposed to place the .htaccess file somewhere else.

Looking for your reply.


April 13th, 2009, 07:00 AM
because you have no rights by default to overwrite those settings. You'll need to have a look at the site configuration and allow overwrite or add the .html as handler in the apache.conf

April 13th, 2009, 07:57 AM
Yeah that's probably not going to work so well. PHP files have the php extention for a reason. Also the PHP code in a php file executes between the <?php and ?> tags.

April 13th, 2009, 08:28 AM
the extension has no meaning if you tell apache how to handle the files.