Sunday, May 01, 2016

PHP scripts inside HTML on webserver with FCGId

There are lots of articles how to enable PHP scripts inside .html files using AddType and/or AddHandler directives in the Apache web-server configuration file.

But if you have the hosting with PHP engine is running as FCGId module, all these tutorials will not work or will issued downloading of the binary file instead of opening the HTML content in the web-browser :(

Here is a workaround that works for me, just modify .conf file of your website in the following way:


DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/xyz/public_html>
...
AddType application/x-httpd-php .html
AddHandler fcgid-script .html
FCGIWrapper /home/xyz/fcgi-bin/php5.fcgi .html
...
</Directory>
RemoveHandler .html

The "magic" comes in the last two lines. Enjoy :)


3 comments:

Jeffy said...

Really nice information here. Thank you and please keep update like this.

SEO Company in Chennai

Suseela Susiee said...



There are lots of information about latest technology and how to get trained in them, like this have spread around the web, but this is a unique one according to me.


SEO Company in Chennai

Jeffy said...


I stumbled upon your blog very interesting! ! Thank you for giving us this
moment of pure happiness.SEO Company in Chennai