If I put the following line in a index.html
file, to make Apache include the index.php
file:
<?php include("/Live/ls_client/index.php"); ?>
visiting the index.html
page shows me this:
<!--?php include("/Live/ls_client/index.php"); ?-->
Why is that? Why doesn't it actually include the PHP file?
As of today (2015, Aug., 1st),
Apache2
inDebian Jessie
, you need to edit:And change the order of that line, bringing index.php to the first position:
PHP will work only on the
.php
file extension.If you are on Apache you can also set, in your
httpd.conf
file, the extensions for PHP. You'll have to find the line:and add how many extensions, that should be read with the PHP interpreter, as you want.
As others have noted, most likely you don't have
.html
set up to handle php code.Having said that, if all you're doing is using
index.html
to includeindex.php
, your question should probably be 'how do I useindex.php
as index document?In which case, for Apache (httpd.conf), search for
DirectoryIndex
and replace the line with this (will only work if you havedir_module
enabled, but that's default on most installs):If you use other directory indexes, list them in order of preference i.e.