Difference between revisions of "Embed PHP into HTML"
Jump to navigation
Jump to search
(to configure your Apache server) |
(.htaccess file) |
||
| Line 4: | Line 4: | ||
[[AddType]] application/x-httpd-php .html .htm | [[AddType]] application/x-httpd-php .html .htm | ||
| + | |||
| + | Some servers may require you to put this line in your .htaccess file (in the directory which has the HTML file: | ||
| + | |||
| + | AddHandler application/x-httpd-php52 .php .htm .html | ||
Revision as of 23:24, November 30, 2010
To embed PHP into HTML, simply enclose your PHP code in <?PHP and ?> tags like this:
<?PHP echo "Hello, world!"; ?>
You may have to configure your Apache server (or have your system administrator do it for you). Include this line in your server's httpd.conf file:
AddType application/x-httpd-php .html .htm
Some servers may require you to put this line in your .htaccess file (in the directory which has the HTML file:
AddHandler application/x-httpd-php52 .php .htm .html