Home  >  Article  >  Backend Development  >  If php is added to html, nothing will be displayed.

If php is added to html, nothing will be displayed.

尚
Original
2019-11-01 17:48:093517browse

If php is added to html, nothing will be displayed.

Create a new html file with the following content:

<html>        
<head>                
    <title>Example</title>        
</head>        
<body>
    <?php    echo "Hi, I‘m a PHP script!";   ?>
</body>
</html>

When executed, it was found that there was no content displayed on the page, ""No expected output;

If php is added to html, nothing will be displayed.

In the configuration of apache (recommended: php server) (/usr/local/ apache/conf/httpd.conf), the html file is not added to the executable type, as follows:

If php is added to html, nothing will be displayed.

As you can see, only the extensions are .php and . phtml files will be executed. So add .html and restart apache, the display is normal

If php is added to html, nothing will be displayed.

service httpd {start|restart|stop}

If php is added to html, nothing will be displayed.

The above is the detailed content of If php is added to html, nothing will be displayed.. 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
Previous article:Can js replace php?Next article:Can js replace php?