I am not able to run a php script on an html page which looks like this:
<link rel="stylesheet" href="stylesheets/displayStylesheet.css">
<?php require ($_SERVER['DOCUMENT_ROOT'].'/php/displayDirectory.php5'); ?>
Here is my .htaccess file:
AddType application/x-httpd-php5 .php5
AddType application/x-httpd-php5 .phps
In my apache.conf I added:
LoadModule php5_module modules/mod_php55.so
However, upon restarting apache, warning displayed that its already loaded.
I have also checked if php is installed, it is and its on version 5. At this point index.html loads displayDirectory.html but php code inside it is not being processed.
Am I missing something?
You have syntax error:
<?php require ('$_SERVER['DOCUMENT_ROOT']./php/displayDirectory.php5'); ?> <?php require ($_SERVER['DOCUMENT_ROOT'].'/php/displayDirectory.php5'); ?>
I've had that problem on IIS and it was caused by syntax errors. I assume you are using Apache, since you are using .htaccess:
PHP files are downloaded by browser instead of processed by local dev server (MAMP)
Apache is downloading php files instead of displaying them
.htaccess will not work if you are using IIS; you need to play around with web.config