|  | Posted by Marcus Bointon on 11/15/05 01:13 
On 14 Nov 2005, at 18:51, Richard Lynch wrote:
 > include_path("/full/path/to/DocumentRoot:" . include_path());
 > This may not be the right syntax/function to set include_path, but it
 > is a dynamic way to set the include path, from within PHP.
 
 Yup, I tried this and it kind-of works, but still leads to some weird
 behaviour.
 
 > INSTEAD, do this.
 >
 > Create a PHP script, and name it 'x'
 >
 > In .htaccess, force 'x' to be PHP as far as Apache is concerned:
 > <Files x>
 >   ForceType application/x-httpd-php
 > </Files>
 >
 > You can now access your "x=123" from $_SERVER['PATHINFO'] (or is it
 > 'PATH_INFO'?
 >
 > No more endless tweaking of Regex rules in httpd.conf and logging the
 > mod_rewrite and dinking with ^/[0-9]+ junk and re-starting Apache
 > every time you want to try a change.
 
 That's a nice trick - I'll have to remember that. My rules are
 in .htaccess (as seems normal for 'deployable' systems) so I don't
 need to restart apache and it's easy to twiddle with them, and
 besides, I like regexes ;^) The issue isn't really the passing of
 parameters (which your approach deals with very nicely), it's that
 PHP gets fooled into thinking that it's somewhere that it's not. The
 most annoying thing about this problem is that I'm sure it should
 'just work', and I know I've seen it do so before in both my scripts
 and others - Serendipity has an almost identical setup for rewrites
 and it doesn't do anything special to work with them - all this
 futzing with paths that mod_rewrite does is long finished by the time
 that PHP gets to hear about anything - PHP never has to know the real
 URL, it should be happy to deal with the rewritten one.
 
 The problem seems to be that given the incoming URL:
 
 /x/123
 
 this gets rewritten to
 
 /x.php?x=123
 
 and it does run the correct script in the correct directory, however,
 once it's running PHP acts as if it had said:
 
 /x/x.php?x=123
 
 Which just breaks paths everywhere. I know that this is what the
 passthrough option is supposed to deal with, but removing it doesn't
 help either. Maybe I should look more carefully at my RewriteBase etc.
 
 I've asked in sitepoint apache forums too, see if anyone there has
 any idea.
 
 Thanks for the ideas.
 
 Marcus
 --
 Marcus Bointon
 Synchromedia Limited: Putting you in the picture
 marcus@synchromedia.co.uk | http://www.synchromedia.co.uk
  Navigation: [Reply to this message] |