|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-01-27 11:23 UTC] stijn at win dot tue dot nl
Description:
------------
I'm trying to turn the support for PATH_INFO off on a *default* install of apache-2.0.52 and php-4.3.10, but it doesn't work.
Note that I am not 100% sure that this is a PHP bug, however Apache does not accept PATH_INFO for regular HTML files so I'm inclined to suspect PHP.
I first installed Apache in a scratch directory:
./configure --prefix=/var/tmp/apachephp --enable-so --with-mpm=prefork --enable-maintainer-mode
gmake
gmake install
Then PHP:
env CFLAGS=-g ./configure --prefix=/var/tmp/apachephp --with-apxs2=/var/tmp/apachephp/bin/apxs --disable-cgi --disable-path-info-check
gmake
gmake install
I edited /var/tmp/apachephp/conf/httpd.conf and added these lines:
%%%
AddType application/x-httpd-php .php
AcceptPathInfo off
<Directory /var/tmp/apachephp/htdocs>
AcceptPathInfo off
</Directory>
%%%
Adding a simple index.php to the docroot (/var/tmp/apachephp/htdocs/index.php):
%%%
<? phpinfo(); ?>
%%%
After starting httpd, I can still browse to
http://localhost/index.php/foo/bar
and see that PATH_INFO indeed contains /foo/bar.
I've tried digging in the sources but I'm not familiar with Apache plugins. I did see this in gdb:
%%%
Breakpoint 2, php_apache_request_ctor (r=0x81b2050, ctx=0x81b3e70)
at /local/home/stijn/tmp/php-4.3.10/sapi/apache2handler/sapi_apache2.c:408
408 SG(sapi_headers).http_response_code = !r->status ? HTTP_OK : r->status;
(gdb) print r->path_info
$1 = 0x81b3253 "/foo/bar"
(gdb) print r->used_path_info
$2 = 1
%%%
So in the request constructor the path info is already set up? I did see something about overriding r->path_info for apache modules in the apache sources but here is where I cannot follow the code anymore...
BTW, I tried to post this to php-general twice, but somehow my e-mail is blocked. I do hope this is not PEBKAC but even if it is I would be glad if someone pointed this out to me...
Reproduce code:
---------------
n/a
Expected result:
----------------
n/a
Actual result:
--------------
see above for a maybe relevant backtrace snippet
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 12:00:02 2025 UTC |
Here is a patch that is *VERY* lightly tested, but which appears to do the right thing for me (I don't see a place to upload a patch in this bug tracker, so I copy & paste this; beware of whitespace changes). %%% --- sapi/apache2handler/sapi_apache2.c.orig Mon Dec 6 19:55:16 2004 +++ sapi/apache2handler/sapi_apache2.c Thu Mar 3 12:46:03 2005 @@ -471,6 +471,12 @@ return DECLINED; } + /* check if we can accept PATH_INFO according to apache config */ + if (r->used_path_info == AP_REQ_REJECT_PATH_INFO + && strlen(r->path_info) != 0) { + return HTTP_NOT_FOUND; + } + if (r->finfo.filetype == 0) { php_apache_sapi_log_message_ex("script '%s' not found or unable to stat", r); zend_try { %%% What do you think?