A method of executing PHP statements for static HTML files

Source: Internet
Author: User
Tags web hosting
The PHP statements in the general HTML file will not be executed, so what is the way to run the PHP code in the HTML file? Small series for everyone to find a few ways, hope to help everyone.

HTML file method for executing PHP statements:

1, modify httpd.conf, command Apache to take HTML as PHP,

The http.conf file in the server needs to be modified.

In Apache httpd.conf, add the following statement:

AddType application/x-httpd-htm. Htmaction application/x-httpd-htm "/php4/php.exe"

General web Hosting, we cannot modify httpd.conf, but we can do it by modifying the. htaccess.

2, modify. htaccess

NEW PHP Add handlerssolutionif You need a ADD handler for PHP * Use the following: #PHP5AddHandler application/x-http D-php5. html. Htm#php4addhandler application/x-httpd-php4. html. Htmthat is if you need to parse. html files or any other Extension as PHP can place the in your. htaccess file.

The above static HTML file to execute the PHP statement method is the whole content, it looks very simple, I hope to give you a reference.

For more HTML and PHP related issues, you can access the PHP Chinese web.

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.