PHP script not working in HTML file

Stop the apache service, then add one change in c:\xampp\apache\conf\httpd.conf in the section by adding...

AddType application/x-httpd-php .html .htm  

Restart apache!

This looks like a big fat 'feature' in the current xampp distribution for win 32-bit.


You should add mime type at http conf for instance in apache at httpd.conf entry

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig "conf/mime.types"
   .......
    AddType application/x-httpd-php .html .htm
   AddType text/html .shtml

    AddOutputFilter INCLUDES .shtml
</IfModule>

I assume you are trying to use php inside .html file? Try adding .htaccess file or changing apache config with the following line:

AddHandler application/x-httpd-php .html

XAMPP already includes PHP, but unless you end the script name with .php it is unlikely to be processed by the PHP engine.

Tags:

Php

Xampp