How to execute php statements in static html files (recommended)
The PHP statements in the HTM file will not be executed. How to run php code in the HTML file?
How to execute php statements in html files:
1. Modify httpd.conf and instruct Apache to treat HTML as PHP.
You need to modify the http.conf file in the server. .
Add the following statement to Apache’s httpd.conf:
AddType application/x-httpd-htm .htm
Action application/x-httpd-htm “/php4/php.exe”
For general virtual hosts, we cannot modify httpd.conf, but we can do so by modifying .htaccess.
2, modify .htaccess
NEW PHP Add Handlers
SolutionIf you need an add handler for PHP please use the following:
#PHP5
AddHandler application/x-httpd-php5 .html .htm
#PHP4
AddHandler application/x-httpd-php4 .html .htm
That is if you need to parse .html files or any other extension as PHP you can place that in your .htaccess file.
The above method (recommended) for executing php statements on static html files is what I share with you. The entire content is here, I hope it can give everyone a reference, and I also hope everyone will support the PHP Chinese website.
For more methods of executing PHP statements on static HTML files (recommended), please pay attention to the PHP Chinese website for related articles!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics









