Home  >  Article  >  Backend Development  >  php cannot be parsed in html

php cannot be parsed in html

藏色散人
藏色散人Original
2019-10-15 09:37:195179browse

php cannot be parsed in html

#php cannot be parsed in html?

Phenomena:

php and apache are installed, but the browser cannot parse the php code for such code.

<html><body><h1>d</h1>
<?php
  echo "test"; 
?>
</body></html>

Solution:

Add the following two items to httpd.conf, restart. OK!

AddHandler php5-script .php .html
AddType text/html .php .html

Note: If it is php7, change the php5-script in the first line to php7-script.

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of php cannot be parsed in html. 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