WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#9166 closed feature request (wontfix)

Installer should check that required constants are defined

Reported by: hakre Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7
Component: Upgrade/Install Keywords: needs-patch
Focuses: Cc:

Description

Beside the fact, that you can come more or less often to the point to start a flame-war because WordPress is designed to have the static configuration settings in a PHP File, some things can be done to improve the installation-easyness and provide better hints to this error-prone way of setting something up.

For Example: WordPress does not verify that really needed config PHP-Constants _are_ defined. Let's assume a user does not understand the configuration and enters the following in wp-config.php

{{{...
define('90a83383_dbYZ', 'putyourdbnamehere'); Der Name der Datenbank, die du benutzt.
define('90a83383_unZUF1', 'usernamehere');
Dein MySQL-Datenbank-Benutzername.
define('xxx', 'yourpasswordhere'); Dein MySQL-Passwort.
...}}}

then the wordpress error message that the connection to the db server failed does not reflect the fact, that the constants DB_NAME, DB_USER or DB_PASSWORD are not defined. Putting out this message clearly, that wp-config.php is not properly configured and the database configuration should be checked would help much instead.

Attachments (1)

9166.patch (761 bytes) - added by hakre 5 years ago.
Such a check function placed in wp-settings.php

Download all attachments as: .zip

Change History (18)

comment:1 mrmist5 years ago

  • Keywords install added
  • Milestone changed from 2.7.2 to 2.8
  • Summary changed from Missing propper check transparently for needed config constants to Installer should check that required constants are defined

comment:2 hakre5 years ago

Maybe #6631 is of interest as well to improve the installing experience.

comment:3 FFEMTcJ5 years ago

  • Milestone changed from 2.8 to Future Release

comment:4 hakre5 years ago

The compontent that use such constants should throw the error in case they need them obligatory.

comment:5 Denis-de-Bernardy5 years ago

suggesting wontfix on this. I mean, if a user can't create a wp-config file, he should use fantastico to install his site, or get hosted on wordpress.com

comment:6 DD325 years ago

Except that WordPress offers to create the wp-config.php file, which makes that arguement completely null.

A short message along the lines of (with better grammer of course) after including wp-config.php could possibly solve a few peopel getting confused.. But.. Hopefully theres enough documentation in the sample file already to explain it.

if ( ! defined('DB_PASS') )
die('wp-config is not configured properly. Please check the config defines');

comment:7 Denis-de-Bernardy5 years ago

  • Keywords needs-patch added; configuration install removed

needs a patch then

hakre5 years ago

Such a check function placed in wp-settings.php

comment:8 hakre5 years ago

First patch. What I do not like is the fact that this code will be executed with every request. So maybe such code should be placed in the wp-config-sample file with a comment that it can be removed if everything works.

that will prevent that it is executed on setups that use the installer as DD32 pointed out.

comment:9 hakre5 years ago

  • Keywords has-patch developer-feedback added; needs-patch removed

comment:10 hakre5 years ago

  • Component changed from Administration to Upgrade/Install
  • Owner anonymous deleted

comment:11 Denis-de-Bernardy5 years ago

  • Keywords dev-feedback added; developer-feedback removed
  • Milestone changed from Future Release to 2.8

comment:12 Denis-de-Bernardy5 years ago

  • Keywords tested added

comment:13 Denis-de-Bernardy5 years ago

  • Keywords commit added; dev-feedback removed

any interest?

comment:15 ryan5 years ago

Is this much of a problem in practice? Regardless, I'd rather have a separate diagnostics tool. "Having a problem? Run this tool to see what's wrong." That way we're not doing these checks on every page load.

comment:16 Denis-de-Bernardy5 years ago

  • Keywords needs-patch added; has-patch tested commit removed

I don't thinks so... my own opinion above:

http://core.trac.wordpress.org/ticket/9166#comment:5

comment:17 ryan5 years ago

  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.