Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: SSI XBitHack with PHP files? |
|
Author |
|
DaveQ
Joined: 20 May 2009 Posts: 1
|
Posted: Wed 20 May '09 22:01 Post subject: SSI XBitHack with PHP files? |
|
|
Thanks in advance for all help!
I use SSI with html files using xbithack, an .htaccess file with:
Options +Includes
XBitHack on
and <!--#include file="SampleFile.inc" --> in the HTML.
How can I include files using xbithack as above in a PHP file? Currently such include attempts are ignored within PHP files. I can't use PHP's
<? include "SampleFile.inc" ?>
because SampleFile.inc includes a mix of HTML, PHP, and JavaScript and the enclosing <? and ?> forces the entire file to be interpreted as pure PHP causing numerous errors. Obviously a newbee question. Thanks for your help! |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Wed 20 May '09 23:15 Post subject: |
|
|
I do not think xbithack is really what you need. I can do it without it.
I do not think I would allow this on my server either, for the same reason you cannot SSI #include in cgi scripts.
However, this was a fun little puzzle but I cannot use a .inc file to include as it sets off mod_security so I chose to use .bla instead. you may still be able to however so toss this in your .htaccess and remove the hack
AddOutputFilter INCLUDES .php
AddType application/x-httpd-php .inc
test.php
Code: |
<?php
echo 'Hello World';
?>
<p />
<!--#include file="Sample.inc" -->
<p />
<?php
echo 'well .. are there two Hello Worlds above?';
?>
<p />
|
sample.inc (.bla for me)
Code: |
Hopefully we see another hello world below<p />
<?php
echo 'Hello World';
?>
|
Output
Code: |
Hello World
Hopefully we see another hello world below
Hello World
well .. are there two Hello Worlda there? |
|
|
Back to top |
|
|
|
|
|
|