Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#7221 closed defect (bug) (fixed)

PHP notice "WP_CONTENT_DIR undefined" occurs when creating wp-config.php

Reported by: lilyfan Owned by: sambauers
Milestone: 2.6 Priority: high
Severity: critical Version: 2.6
Component: General Keywords: has-patch, installer
Focuses: Cc:


The first step of installing: wordpress can create a wp-config.php file with setup-config.php. In this step, WP_CONTENT_DIR is not defined. But wp-includes/functions.php does not cosider the situation. So, a PHP notice occures: Use of undefined constant WP_CONTENT_DIR - assumed 'WP_CONTENT_DIR' in /home/*/public_html/wp-includes/functions.php on line 1988

To solve the problem: change line 1988 of wp-includes/fuctions.php below: if (defined('WP_CONTENT_DIR') && file_exists( WP_CONTENT_DIR . '/db.php' ) )

Attachments (1)

define_wp_content_dir_for_install.patch (748 bytes) - added by sambauers 10 years ago.

Download all attachments as: .zip

Change History (5)

#1 @DD32
10 years ago

To solve the problem: change line 1988 of wp-includes/fuctions.php below: if(defined('WP_CONTENT_DIR') && file_exists( WP_CONTENT_DIR . '/db.php' ) )

Only problem with that, Is that to install, it means the user *must* use mysql/default database.

A better solution would be for the install script to define the new definitions at a best-guess i think.

#2 @sambauers
10 years ago

  • Owner changed from anonymous to sambauers

DD32 is probably right about defining a best guess at that early stage, either that or skip that part during install. I'll look into it.

#3 @sambauers
10 years ago

  • Keywords has-patch installer added; setup-config removed
  • Severity changed from normal to critical

Patch defines WP_CONTENT_DIR at the start of setup-config.php along with the others. That should fix it.

#4 @ryan
10 years ago

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

(In [8238]) Define WP_CONTENT_DIR in setup-config.php. Props sambauers. fixes #7221

Note: See TracTickets for help on using tickets.