HTML page embedding PHP code does not display content

Source: Internet
Author: User

Create a new HTML file with the following contents:

<title>Example</title>

<body>

<?php echo "Hi, I ' m a php script!"; ?>

</body>

Execution found that the page does not have any content to display, "<?php echo" Hi, I ' m a php script! "; ?> "no expected output;

After analyzing the reason, it was found that in Apache configuration (/usr/local/apache/conf/httpd.conf), the HTML file was not added to the executable type, as follows:

As you can see, only files with the extension. PHP and. phtml will be executed. So Add. html and restart Apache, show normal

Service httpd {Start|restart|stop}

HTML page embedding PHP code does not display content

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.