-3

PHP tag is not working in my index.html file

But if I change index.html to index.php then it prints the app.js code on index file.

Evan Carslake
  • 2,267
  • 15
  • 38
  • 56
Hassan Shahid
  • 16
  • 1
  • 4

1 Answers1

1

What web server are you using? Your web server is probably not configured to run PHP files with an html extension.

According to the answer from this question, you can configure Apache to run files with an html extension as PHP using a .htaccess file.

Create a .htaccess file at the root of your website and add this line:

[Apache2 @ Ubuntu/Debian: use this directive]

AddType application/x-httpd-php .html .htm
mittmemo
  • 2,062
  • 3
  • 20
  • 27
  • 1
    You need to configure your Apache to run files with `html` extension as PHP files. See my updated answer. – mittmemo Jul 01 '15 at 16:20