WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#1591 closed defect (bug) (fixed)

The difference in $_SERVER['PATH_INFO']

Reported by: gslin Owned by: markjaquith
Milestone: Priority: normal
Severity: normal Version: 1.6
Component: General Keywords: cgi bg|has-patch bg|squashed bg|commit
Focuses: Cc:

Description

I run WordPress 1.6-ALPHA2-still-dont-use in DreamHost, it's default PHP setting is CGI mode (php-cgi) and I perfer this mode for security reason.

If I enable permlinks with "Custom structure" and then WordPress will write the following rules in .htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>
# END WordPress

In mod_php mode $_SERVERPATH_INFO? will be NULL, and in php-cgi mode it will be '/index.php' (by .htaccess).

The attachment patches classes.php to check if $pathinfo is index.php.

Attachments (2)

classes-php.diff (450 bytes) - added by gslin 9 years ago.
wp-settings.php.diff (746 bytes) - added by markjaquith 9 years ago.
Patch for WP 1.6 SVN

Download all attachments as: .zip

Change History (12)

gslin9 years ago

comment:1 gslin9 years ago

  • Keywords cgi added
  • Owner changed from anonymous to matt

comment:2 markjaquith9 years ago

  • Keywords bg|has-patch added

comment:3 ryan9 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [2852]) If PATH_INFO contains the index, don't use it for permalinks. Props gslin. fixes #1591

comment:4 markjaquith9 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This is still the problem. this was my solution:

if ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 )
	$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
if ( $_SERVER['PATH_INFO'] == $_SERVER['PHP_SELF'] )
	unset($_SERVER['PATH_INFO']);

Fixes two problems with PHP as CGI on Dreamhost.

markjaquith9 years ago

Patch for WP 1.6 SVN

comment:5 markjaquith9 years ago

Make that "This is still a problem"

comment:6 markjaquith9 years ago

  • Keywords bg|squashed bg|commit added

comment:7 markjaquith9 years ago

  • Milestone set to 1.6
  • Owner changed from matt to markjaquith
  • Status changed from reopened to new

comment:8 markjaquith9 years ago

  • Status changed from new to assigned

comment:9 matt9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [3034]) Fixes #1591 (again)

comment:10 anonymous8 years ago

  • Milestone 2.0 deleted

Milestone 2.0 deleted

Note: See TracTickets for help on using tickets.