logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

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.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: SSI XBitHack with PHP files?
Author
DaveQ



Joined: 20 May 2009
Posts: 1

PostPosted: Wed 20 May '09 22:01    Post subject: SSI XBitHack with PHP files? Reply with quote

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

PostPosted: Wed 20 May '09 23:15    Post subject: Reply with quote

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


Reply to topic   Topic: SSI XBitHack with PHP files? View previous topic :: View next topic
Post new topic   Forum Index -> Apache