Tos Web Developer provides insights, tutorials, and advice around topics including content strategy, design, Drupal Development, Drupal Custom Module Development, Drupal 8 Custom themes, PHP, Server, Twig, and more

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:

 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

| Designed And Blog Post by www.toswebdeveloper.com