Page MenuHomePhabricator

Wrong redirect (PHP as CGI, PATH_INFO)
Closed, ResolvedPublic

Description

Author: angryxpeh3

Description:
I'm using last svn version (17851), update.php applied.

When trying to get any page, I receive such headers:

HTTP/1.0 301 Moved Permanently
Date: Wed, 22 Nov 2006 13:47:44 GMT
Server: Apache/1.3.37 (Unix) mod_throttle/3.1.2 DAV/1.0.3 mod_fastcgi/2.4.2
mod_gzip/1.3.26.1a PHP/4.4.4 mod_ssl/2.8.22 OpenSSL/0.9.7e
Cache-Control: private, must-revalidate, max-age=0
Content-Encoding: gzip
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Vary: Accept-Encoding,Cookie
X-Powered-By: PHP/5.1.2
Last-Modified: Wed, 22 Nov 2006 13:47:45 GMT
Location: http://wiki.rw.kiev.ua/index.php?title=Index.php
Content-Type: text/html

After that, browser goes to infinite loop.


Version: 1.9.x
Severity: minor
OS: Windows Server 2003
Platform: PC

Details

Reference
bz8007

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:28 PM
bzimport set Reference to bz8007.
bzimport added a subscriber: Unknown Object (MLST).

What is your MySQL version? The version 5 of MySQL is recommended.

And donno what's wrong with your php version, it have both Server: PHP/4.4.4 and X-
Powered-By: PHP/5.1.2 entries respectively.

robchur wrote:

Actually, we don't recommend MySQL 5 as such.

angryxpeh3 wrote:

MySQL version is 5.0.24a.
PHP4 is used as mod_php and PHP5 used for CGI. Actually, PHP5 is used for
index.php processing.

Anything worked perfectly ont his configuration until I run some recent svn
checkout.

I've added
print "TITLE: $title" after line 15 of index.php, and it return "TITLE:
index.php" for every request with "redirect=no" in URL.

I've copied index.php to run.php and tried to open
/run.php?title=Main_Page&redirect=no -- "TITLE: run.php" is shown then.

Can it be something with index.php elimination? I have
$wgArticlePath = "$wgScript?title=$1";

in LocalSettings.php, but maybe something is wrong with it?

It looks like you've got broken PATH_INFO on this box.

  1. Can you check whether 'cgi.fix_pathinfo' is set in php config? (Unfortunately this doesn't

seem to be checkable directly from within PHP; for 1.9 we check indirectly but it may not
always be working right.)

Try setting cgi.fix_pathinfo explicitly to 'on' and to 'off' in php.ini (and restart as necessary;
FastCGI daemons may still be running)

  1. Check contents of PATH_INFO and ORIG_PATH_INFO. Make a PHP 5 script containing:

<?php
echo htmlspecialchars($_SERVER["PATH_INFO"]);
echo "<br>";
echo htmlspecialchars($_SERVER["ORIG_PATH_INFO"]);
?>

and go to http://example.com/scriptname.php/Foobar (as appropriate).

What do they contain?

  1. If possible, provide details of Apache configuration so it can be reproduced.

If necessary, you should be able to work around this by setting $wgUsePathInfo = false;
in LocalSettings.php. This will suppress use of the PATH_INFO bits, which are apparently
coming through corrupt.

Reducing priority/severity. Redirect problems are a common complaint when
setting up a new wiki. Perhaps we could do more to detect or prevent them, but
they can always be fixed with proper configuration.

This was probably resolved by the new title interpolation in 1.10/1.11. Resolved as FIXED; if problems continue, please test with the upcoming 1.12 release and reopen with details.