Make WordPress Core

Opened 16 years ago

Closed 15 years ago

#9474 closed defect (bug) (fixed)

Installation fails produces a blank screen on a default CentOS 5 Server Install

Reported by: shawnmjones's profile shawnmjones Owned by:
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.7.1
Component: Upgrade/Install Keywords: has-patch
Focuses: Cc:

Description

On a default CentOS 5 server install, Apache and PHP are installed on the system, but not enough of PHP is installed to make WordPress function. Unfortunately, the end user is presented with a blank screen and no error messages when the WordPress install is run.

Suggestions of raising the amount of memory allocated to PHP and turning on (or off) error reporting within PHP yield no change. Logs for Apache reveal nothing as well. Turning off (or on) SELinux does nothing either.

Upon an examination of the source code, it is revealed that line 318 of wp_db.php within the wp-includes directory contains an @ symbol in front of the mysql_connect function. An error is produced if this function does not exist within the php installation, but because of this @ the error is never displayed.

Ref:
http://us.php.net/manual/en/language.operators.errorcontrol.php

I assume the developers wanted this error to be "caught" at some future point in the code, but that appears to never occur, so those of us with a default CentOS 5 install don't have any clues as to how to fix the issue.

The fix for CentOS 5 is to install the php-mysql package for the system.

The fix for WordPress appears to be removing the @ so that administrators receive an error message when the mysql functions are not present, but I do not know what the intention was for the code in question, so perhaps the bug is in whatever was supposed to "catch" this error.

Searches of "Wordpress install blank screen" on Google have revealed a number of confused users/administrators. I wonder how many of them have this same issue and don't even realize it.

Attachments (2)

9474.diff (873 bytes) - added by Denis-de-Bernardy 16 years ago.
9474.2.diff (1.0 KB) - added by dd32 15 years ago.

Download all attachments as: .zip

Change History (15)

#1 follow-up: @DD32
16 years ago

I know for a fact that on a default CentOS5 install, It gives a warning about MySQL not being installed...

Here's the line which displays an error if the user doesnt have MySQL enabled: http://core.trac.wordpress.org/browser/trunk/wp-settings.php#L143

and heres the line, which includes wp-db: http://core.trac.wordpress.org/browser/trunk/wp-settings.php#L259

Now.. As to why you didnt get the error, I'm not sure.... Do you have a custom db.php file in wp-content/db.php ? (I'm thinking maybe a distribution is including it for some reason?)

#2 in reply to: ↑ 1 @shawnmjones
16 years ago

  • Cc shawnmjones added

Replying to DD32:

I know for a fact that on a default CentOS5 install, It gives a warning about MySQL not being installed...

Here's the line which displays an error if the user doesnt have MySQL enabled: http://core.trac.wordpress.org/browser/trunk/wp-settings.php#L143

and heres the line, which includes wp-db: http://core.trac.wordpress.org/browser/trunk/wp-settings.php#L259

Now.. As to why you didnt get the error, I'm not sure.... Do you have a custom db.php file in wp-content/db.php ? (I'm thinking maybe a distribution is including it for some reason?)

I've set up a new VM of a default CentOS server install. I only added the package mysql-server. I downloaded the WordPress tgz and uncompressed/untarred it within /var/www/html (the default web server docs directory).

There is no wp-content/db.php present.

I get this error when visiting the site with a web browser:

There doesn't seem to be a wp-config.php file. I need this before we can get started. Need more help? We got it. You can create a wp-config.php file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.

I clicked the button "Create a Configuration File". This passes me to setup-config.php which tells me that I need to know my database information in order to run setup. I click "Let's Go!" and am presented with a form to fill in my database information.

Upon clicking "Submit" I get a blank screen. No error message is presented.

There is still no wp-content/db.php present.

A very cursory look at setup-config.php does not show wp-settings.php has been included.

I inserted the following code before line 318 of wp_db.php:

$smj_included_files = get_included_files();
echo "included files so far:<br>";
echo "--------<br>";
foreach ($smj_included_files as $smj_filename) {
  echo "$smj_filename<br>";
}
echo "--------<br>";

which produces the following output in the browser:

included files so far:
--------
/var/www/html/wordpress/wp-admin/setup-config.php
/var/www/html/wordpress/wp-includes/compat.php
/var/www/html/wordpress/wp-includes/functions.php
/var/www/html/wordpress/wp-includes/classes.php
/var/www/html/wordpress/wp-includes/wp-db.php
--------

It doesn't look like the contents of wp-settings.php ever get loaded at this point.

#3 @DD32
16 years ago

  • Keywords needs-patch added
  • Milestone changed from Unassigned to 2.8

Ah.... You're correct.

I've always had a wp-config.php file already, So it takes a slightly different code path.

The WordPress Installer needs to check for the requirements.. as it doesnt load /wp-settings.php which is where the checks currently are.

#4 @Denis-de-Bernardy
16 years ago

  • Keywords has-patch 2nd-opinion added; needs-patch removed

patch attached, but it's really odd that WP doesn't check all of the requirements before prompting the user to create a config file. including the wp-settings.php with a predefined stop-point would probably be a better fix.

#5 @Denis-de-Bernardy
16 years ago

probably something like this...

in wp-load.php:

if no config file, then define(WP_CONFIG_CHECK) (or maybe WP_INSTALLING, if that works out of the box), then include wp-settings

in wp-settings.php:

if defined WP_CONFIG_CHECK, return once the needed functions are defined

That way, there wouldn't be two separate checks for the mysql extension in the code base -- one of which we're bound to forget about.

#6 @ryan
16 years ago

WPMU checks SHORTINIT.

#7 @Denis-de-Bernardy
16 years ago

  • Keywords needs-patch added; has-patch 2nd-opinion removed

k... related changesets are at:

http://trac.mu.wordpress.org/changeset/1116

http://trac.mu.wordpress.org/changeset/1323

http://trac.mu.wordpress.org/changeset/1582

delegating this to whoever wants to go through the testing, as adding the hook and moving things around will most certainly have consequences.

#8 @Denis-de-Bernardy
16 years ago

  • Milestone changed from 2.8 to 2.9

moving to 2.9

#9 @Denis-de-Bernardy
15 years ago

  • Milestone changed from 2.9 to Future Release
  • Priority changed from high to low
  • Severity changed from major to minor
  • Type changed from defect (bug) to enhancement

#10 @Denis-de-Bernardy
15 years ago

  • Component changed from Administration to Upgrade/Install

@dd32
15 years ago

#11 @dd32
15 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 2.9
  • Priority changed from low to normal
  • Severity changed from minor to normal

attachment 9474.2.diff added

  • Working patch
  • Mimmicks the wp-settings.php checks, With the correct filepaths and wp_die() to suit the rest of the file.

Priority/Severity: This is an annoying bug for new users, Many will not realise why they're greeted with a blank screen, Or, Why the installer let them install without having the required version of PHP.

It also affects most standard PHP windows installs, as they dont have a builtin mysql extention either.

#12 @dd32
15 years ago

  • Type changed from enhancement to defect (bug)

#13 @azaozz
15 years ago

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

(In [12238]) Show errors when minimum requirements are not met when installing, props dd32 Denis-de-Bernardy, fixes #9474

Note: See TracTickets for help on using tickets.