Home >Backend Development >PHP Problem >HTML embedded php code does not execute
First, open the [httpd.conf] file found in the installation directory where Apache is installed, i.e. apache\conf, open it with Notepad, and add the following code at the end:
As shown below:
Note:
(1) Add After the above code, the Apache server must be restarted;
(2) The html file must be placed in the directory specified by DocumentRoot in the Apache configuration file httpd.conf, otherwise it cannot run, see the figure below:
If you only want to include and run the php script in an html file, then you can set it up like this:
As shown below, Among them, index.html is a file with PHP code (script) added. The # in front of #AddType application/x-httpd-php .htm .html means to comment out the line of statement.
Recommended tutorial: PHP video tutorial
The above is the detailed content of HTML embedded php code does not execute. For more information, please follow other related articles on the PHP Chinese website!