When a given file contains PHP code, it must have a PHP extension. In most cases, this is .php, but you can also configure the .htaccess file to read the PHP code in the HTML file without renaming it or changing its extension. Below you can view the "handlers", which will have to be added in order to achieve this For a normally configured web server:
A web server running FastCGI:
You can't run PHP in .html files because the server does not recognize that as a valid PHP extension unless you tell it to. To do this you need to create a .htaccess file in your root web directory and add this line to it:
This will tell Apache to process files with a .htm or .html file extension as PHP files.
AddHandler cgi-script .html .htm
A web server running FastCGI:
AddHandler fcgid-script .html .htm
You can't run PHP in .html files because the server does not recognize that as a valid PHP extension unless you tell it to. To do this you need to create a .htaccess file in your root web directory and add this line to it:
AddType application/x-httpd-php .htm .html
This will tell Apache to process files with a .htm or .html file extension as PHP files.
No comments:
Post a Comment