Skip to main content
Help Center
The GoDaddy Community will undergo maintenance starting on Wednesday, August 4th at 3pm PST / 6pm EST. Learn more
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Getting Started

Running php in html files

Does anyone know how to call a php script from within an HTML file?


Do I need to do anything on the server side to get it to work?  I added a file named ".htaccess" to the directory my script is located in that contains the following line:


AddType application/x-httpd-php5 .html .htm


However, when I try to access the HTML page, it just automatically downloads the HTML file to my desktop for some odd reason.


Help please!


Thank you!


Rename the html file to a php file in order to use php code.

How to allow PHP inside HTML by some settings in web.config  (without using .PHP extension)

I have seen tried the following but it causes the whole web site to fail.


handlers accessPolicy="Read, Script">
         <add name="PHP via FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP\php-cgi.exe|-d open_basedir=C:\Websites\Website1" resourceType="Unspecified" requireAccess="Script" />


Were you able to find a fix for this?  I have the same issue running htm files as php. 


My old site used AddType/Addhandlers method, but I cant seem to make that work with GoDaddy.



1. Add following 3 lines to your .htaccess file in public_html folder


Options +ExecCGI

AddHandler fcgid-script .html

FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .html


2. Inside html files php code goes between <?php   ?> tags, for example:


<?php echo 'Hello World'; ?>