Yes, you can run PHP in an HTML page.
I have successfully executed PHP code in my HTML files for many years. (For the curious, this is because I have over 8,000 static HTML files created by me and others over the last 20 years and I didn't want to lose search engine ranking by changing them and, more importantly, I have too many other things to work on).
I am not an expert -- below is what I've tried and what works for me. Please don't ask me to explain it.
Everything below involves adding a line or two to your .htaccess file.
Here is what one host ( http://simolyhosting.net ) support did for me in 2008 -- but it no longer works for me now.
That solution appears to be deprecated now, though it might work for you.
Here's what's working for me now:
(This page has PHP code that executes properly with the above solution -- http://mykindred.com/bumstead/steeplehistory.htm )
Below are other solutions I found -- they are NOT MINE:
I'm seeing this across many servers I've recently upgraded to EA4. Using cPanel Apache handlers or adding this directly in to .htaccess (same as cPanel does through gui add handlers):
Sep 9, 2016
Open a text editor such as wordpad, notepad, nano, etc. and add the following line:
If you want to use PHP 5.4 instead of PHP 5.2 then use the following line instead:
To run HTML using FastCGI/PHP, try adding this code to the .htaccess file for the directory the script is in:
You can add additional lines for other file extensions if needed.
answered Sep 22 '16 at 17:44
4155 bronze badges
- How do I find mentorship in IT
- Why is Selfridges so expensive
- In what soil do succulents grow best
- Is the Internet biased towards Google
- Where I can get this foldable hanger
- How can I calculate without a calculator
- Can I impress an Indian girl
- XLR8 Plus How does it works
- Is this cell tower an LTE site
- Does being fat stunt growth
- What is QoS classification
- Who needs dermatology advice
- How relevant is Bing
- What does boofing meth do
- What do Bangaloreans think of BMTC buses