I am trying to print the output of php file in HTML using server side includes. Here is the code of index.html file.
<!DOCTYPE html>
<html>
<body>
<!--#include file="include.php" -->
<h1>This is a Example Of Server Side Includes</h1>
</body>
</html>
Here is the code of my include.php file.
<?php
echo "Hello From PHP\n";
echo "Hello To HTML\n";
?>
Here is the content of my .htaccess
file.
Options +Includes
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
All the files located in /var/www/html.
This is the screen shot of while executing index.html.
Does Server Side Includes also work in localhost? if yes How to configure? And where to put .htaccess file in var/www/html.
If you're using PHP, you need to have a file with the PHP extension. You cannot use PHP in a file with an HTML extension. Change index.html to index.php