Make WordPress Core

Opened 13 years ago

Closed 10 years ago

Last modified 10 years ago

#18165 closed defect (bug) (worksforme)

Admin tables empty when installed on *nix with Apache 2.x, PHP 5.3 running as CGI with wrapper script

Reported by: magdude's profile magdude Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2.1
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

  • Wordpress 3.2.1
  • Apache 2.2.3
  • PHP 5.3.5

When running with suexec through a wrapper script such as set up by Webmin, the PHP_SELF variable is "fixed" by PHP to point to the wrapper instead of the actual script. This in turn kills some of the admin lists (posts are empty) along with problems setting theme (Thematic) options.

To recreate, adjust httpd.conf vhost to:

<VirtualHost *:80>
  SuexecUserGroup "#1111" "#2222"
  ServerName example.com
  DocumentRoot /home/example.com/www
  ErrorLog /home/example.com/logs/error_log
  CustomLog /home/example.com/logs/access_log combined
  ScriptAlias /cgi-bin/ /home/example.com/cgi-bin/
  <Directory /home/example.com/www>
    Options Indexes IncludesNOEXEC FollowSymLinks
    allow from all
    AllowOverride All
    Action application/x-httpd-php5 /cgi-bin/php5.cgi
    AddType application/x-httpd-php5 .php5
    AddType application/x-httpd-php5 .php
  </Directory>
  <Directory /home/example.com/cgi-bin>
    allow from all
  </Directory>
  RemoveHandler .php
  RemoveHandler .php5
</VirtualHost>

Add the following shell script /cgi-bin/php5.cgi

#!/bin/bash
PHPRC=$DOCUMENT_ROOT/../etc/php.ini
export PHPRC
umask 022
SCRIPT_FILENAME=$PATH_TRANSLATED
export SCRIPT_FILENAME
exec /usr/bin/php-cgi

Copy the php.ini file to /home/example.com/etc/

The problem is temporarily solved by setting the following PHP option in php.ini:

cgi.fix_pathinfo = 0

Which tell PHP not to do a path gawk. I think what should be done is Wordpress should not use PHP_SELF or at least prefer using ORIG_PHP_SELF if it exists, possibly resetting PHP_SELF for downstream functions.

Attachments (2)

18165.patch (1.0 KB) - added by kurtpayne 13 years ago.
No longer require cgi.fix_pathinfo = 1
18165.1.patch (1.5 KB) - added by kurtpayne 13 years ago.
No cgi.fix_pathinfo = 1 and no regex

Download all attachments as: .zip

Change History (9)

#1 @kurtpayne
13 years ago

  • Cc kpayne@… added
  • Keywords reporter-feedback added

I'm not able to recreate this with 3.3-trunk using the configuration you've provided. Can you recreate this with 3.3? If not, can you provide more information about your setup, perhaps screen shots / logs / etc about what's breaking?

@kurtpayne
13 years ago

No longer require cgi.fix_pathinfo = 1

#2 @kurtpayne
13 years ago

  • Keywords has-patch added

@magdude, I managed to get my setup to match yours and was able to reproduce this. I've attached 18165.patch, which has resolved things on my end. Please report back with your test results.

#3 @nacin
13 years ago

If this is a good fix, we should see if we can speed this up by avoiding regular expressions.

What does SCRIPT_FILENAME, SCRIPT_NAME, and PHP_SELF look like in this setup?

@kurtpayne
13 years ago

No cgi.fix_pathinfo = 1 and no regex

#4 @chriscct7
10 years ago

  • Keywords reporter-feedback removed

@nacin did you want to revisit this?

#5 @magdude
10 years ago

Nope, I think you can close this, thanks :)

#6 @magdude
10 years ago

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

#7 @DrewAPicture
10 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.