Why is my SSI not working?

I am having problems passing request parameters to SSI from within my zend framework application.

I am trying to include a PHP file in another PHP:

<!--#include virtual='/ssi/test.php?x=hello' --> 

This works correctly if my hellotest.php (which contains the line above) is in my document root directory.

If, however, I do the same from inside my template.phtml (not / public_html / hellotest.php) (I use the Zend Framework for this project), test.php is called and executed without any query parameters (in this case x = hello). No request parameters are passed to test.php from our zend_framework templates.

Does this have anything to do with how the zend framework uses .htaccess? Here is a copy of my .htaccess files (in the web root: /public_html/.htaccess)

 SetEnv APPLICATION_ENV development AddOutputFilter INCLUDES .php RewriteEngine On RewriteRule (.*/?)(.*css)$ combine.php?type=css&files=$1$2 [NC,L] RewriteRule (.*/?)(.*js)$ combine.php?type=js&files=$1$2 [NC,L] RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] 

EDIT: Recently, I found out that it will pass parameters to SSI taken from the URL. Therefore, if in my browser I type http://www.test.com/controller/action?param1=something , it will actually pass param1 to SSI, but it will completely ignore the parameters that I have SSI lines .... who have experience?

EDIT2 - in response to Tim Fountain: right, my test.php is in public_html / ssi / test.php. However, I am calling from the ZF template file, which ZF always parses. Not sure what you mean "as long as it is not processed by ZF." In my test.php, I just exit var_dump ($ _ GET) - nothing else in this php file, just one line. And the way I call it from the ZF template file looks like this: <!--#include virtual='/ssi/test.php?x=hello' -->

. it is strange that if I type http://mydomain.com/controller/action/?x=hi_there , it will actually pass this parameter X to my SSI include line and overwrite everything I was originally there (x = hello). If I do not pass anything in the URL, nothing will be transferred to the SSI.

+6
php apache2 zend-framework
source share
2 answers

Instead of using SSI include, you can try using the php virtual function:

 virtual ("/ssi/test.php?x=hello"); 

via http://www.zytrax.com/tech/php/php_ssi.htm

What caching requires the use of SSI? Could you just use something like Zend_Cache_Frontend_Output?

+2
source share

I have never seen SSI used with PHP this way, so this is something long, but can you try changing:

 AddOutputFilter INCLUDES .php 

in

 AddOutputFilterByType INCLUDES text/html 

the reason it doesn't work is because your files no longer have the .php extension (or any extension), since you are routing everything through index.php. The change I suggested will filter all text / html output (which should include PHP), although the SSI parser, instead of doing it by extension.

+1
source share

All Articles