Home >Backend Development >PHP Problem >HTML embedded php code does not execute

HTML embedded php code does not execute

王林
王林Original
2019-10-19 13:17:378686browse

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:

HTML embedded php code does not execute

As shown below:

HTML embedded php code does not execute

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:

HTML embedded php code does not execute

If you only want to include and run the php script in an html file, then you can set it up like this:

HTML embedded php code does not execute

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.

HTML embedded php code does not execute

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn