1

I know the title is vague, but the details for this particular question would make the title absurd.

I have an index.php file that has a virtual include within it:

<!--#include virtual="/includes/header.include"-->

This header.include file is HTML and I want to add a few lines of PHP inside of it.

My .htaccess file is set up to process .include files as php. The actual line from the .htaccess file is:

AddType application/x-httpd-php .include

The PHP that I'm trying to add is:

<?php echo "test <br />"; ?>

But when I load the website, the only thing that prints is:

"; ?>

If I view the source of the index.php I can see the entire PHP code that I have above.

Some other things I've already tried:

What am I doing wrong? Why won't the PHP get parsed correctly?

My PHP version is 5.1.6

Community
  • 1
  • 1
CheeseConQueso
  • 5,831
  • 29
  • 93
  • 126
  • If you run the `header.include` file directly from the browser, does the PHP execute then? If it does, perhaps `#include` will not take any script interpreters into account? – halfer May 22 '14 at 23:00
  • ... that said, do check that your htaccess file is actually being read and processed. – halfer May 22 '14 at 23:03
  • the line: Use
    instead of
    is not correct. Rather the
    tag can be self closed (rather that having a second tag ) the correct format is
    <== note the space before the '/' Why make the include 'virtual' when a simple BTW: is that includes sub directory really at the file system root? probably not, so a better line might be: rename the file to header.php then include it with:
    – user3629249 May 23 '14 at 00:05
  • @halfer - no.. the doc isnt found.. thats why the include virtual command was used... it points somewhere away from the html doc root. thats why i tried to copy the htaccess file over – CheeseConQueso May 23 '14 at 10:16
  • @user3629249 -if you read the things ive tried, that was one of them...
    also doesn't work
    – CheeseConQueso May 23 '14 at 10:17
  • I've found a workaround for my problem on this post: http://stackoverflow.com/questions/3733053/get-url-and-parameters-with-ssi – CheeseConQueso May 23 '14 at 13:36

0 Answers0