| Include Virtual works on some, but not others
|
lappert2001

msg:4421472 | 8:08 pm on Feb 24, 2012 (gmt 0) | This is driving me crazy. I would appreciate any help. We have an older hand-crafted web site with many pages using SSI include virtual, and using the Xbithack instead of naming the files .shtml. On our old server, Apache 1.3, the pages worked well. But we recently moved to a new box with Debian Squeeze and Apache 2.2. Now things are in a state where some of the includes on a page work, and some don't. For example, on our home page, we have: <!--#include virtual="./path/adverts/ads.pl--> This works OK as an ad banner rotation system. But on the same page we have: <!--#include virtual="rss2html.php?XMLFILE=http://outside_domain.com/path/atom.xml&TEMPLATE=http://example.com/sample-template.html&MAXITEMS=4" --> This is not working. Instead the page displays "[an error occurred while processing this directive]" We know the file rss2html.php works when invoked by itself outside of being embedded in an html page. Below are our Vhost and .htaccess files in the top docroot directory. <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName example.com ServerAlias *.example.com DocumentRoot /home/domainname/public_html/ XBitHack On <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /home/domainname/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> <Directory /home/domainname/public_html/> AllowOverride All Options Indexes FollowSymLinks Includes ExecCGI Order allow,deny allow from all </Directory> # omitting cgi-related directives # omitting logging-related directives </VirtualHost> |
| in the directory /home/domainname/public_html, the .htaccess file is: # Set some options. Options -Indexes Options +FollowSymLinks # Customized error messages. ErrorDocument 404 /index.html # Set the default handler. DirectoryIndex index.html index.php DirectorySlash On # AuthUserFile /dev/null # AuthGroupFile /dev/null # XBitHack Full |
|
|
penders

msg:4421520 | 12:25 am on Feb 25, 2012 (gmt 0) | | <!--#include virtual="rss2html.php?XMLFILE=http://outside_domain.com/path/atom.xml&TEMPLATE=http://example.com/sample-template.html&MAXITEMS=4" --> |
| Any difference if you omit the querystring? Is the PHP file being parsed for SSIs? Are PHP files the problem? Only reason I ask is that I was having a play with SSIs a few weeks back but it all started to go very wrong when I began parsing PHP files for SSIs as well, but I didn't pursue it so I'm not really sure what the problem was! :/
|
lappert2001

msg:4421526 | 12:46 am on Feb 25, 2012 (gmt 0) | It works if I take it our of the html page and run the .php file on it's own (with the query strings). The log files say the php file is not being parsed. There are perl cgi files on the same page which do work. I'd say it was the php file ... except that they all worked before in the previous box, under Apache 1.3 and PHP 4.3.
|
Key_Master

msg:4421534 | 1:14 am on Feb 25, 2012 (gmt 0) | Adding the following line may work on your server:
Addhandler application/x-httpd-php .html
You can replace or add extra handlers depending on what type of page the php code will be executed on.
|
lappert2001

msg:4421696 | 1:54 pm on Feb 25, 2012 (gmt 0) | Thanks Pender and Key_Master for the replies, and I'll certainly keep the Addhandler tip in mind. From another source, I was able to find a fix, at lease one that works in the short term. I didn't really consider this as I had dealt with this issue many years ago (in the 90's) and thought I had gotten it right for any instance of include virtual (or for "exec cgi" for that matter). On the php comment, the invocation is simple "rss2html.php" with additional arguments. That's a relative URL. I changed it to an absolute from the docroot by making it: "./rss2html.php" and keeping the two arguments. Strangely, the arguments are still URL's. On the old server, the php file invocation worked as a URL. Over the years I've found no general rule of thumb on whether to use URLs or addresses either from root or docroot. It seems to work sometimes one way and other times the other way. Thanks again.
|
penders

msg:4424176 | 4:34 pm on Mar 2, 2012 (gmt 0) | I changed it to an absolute from the docroot by making it: "./rss2html.php" |
| Isn't this relative to the current working directory (.)? If you omitted the dot prefix then it would be 'absolute' (or root-relative) to the docroot. "rss2html.php" on the other hand is relative to the current document. Is it possible that the current working directory and the location of the document being parsed are different?
|
lappert2001

msg:4424193 | 4:58 pm on Mar 2, 2012 (gmt 0) | In this case, the html file being parsed is the web site's home page and it exists as /home/username/public_html/index.html which is docroot. The file rss2html.php is in the same directory, so it would be /home/username/public_html/rss2html.php. For whatever reason, it's now working with the ".\" added, and fails to work with the dot-slash.
|
|
|