-1

I am trying to have XAMPP's Apache execute <?php ... ? that is embedded in a HTML document:

<html>
<head><title>abc</title></head>
<body>

<?php
  echo("bla");
?>

</body>
</html>

However, the <?php ... ?> part is not "executed" and transferred to the browser verbatim.

I suppose there is a configuration file that I have to change so that the piece of php is executed.

René Nyffenegger
  • 39,402
  • 33
  • 158
  • 293

1 Answers1

1

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

If you are trying to use php inside .html file then try adding .htaccess file or changing apache config with the following line:

AddHandler application/x-httpd-php .html

Or try the following,

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!

Hope this will help.

Sifat Haque
  • 5,357
  • 1
  • 16
  • 23