When I reinstalled my Wordpress site on a new server, I was stuck with a HTTP ERROR 500 page, and this showed in the logs :

[proxy_fcgi:error] [pid 87631:tid 140347891410624] [client xxxx:9316] AH01071: Got error
PHP message: PHP Fatal error:
  Uncaught Error: Undefined constant "WP_CONTENT_DIR" in /var/www/site/wp-includes/load.php:141
Stack trace:
#0 /var/www/site/wp-settings.php(29): wp_check_php_mysql_versions()
#1 /var/www/site/wp-config.php(92): require_once('/var/www/site...')
#2 /var/www/site/wp-load.php(37): require_once('/var/www/site...')
#3 /var/www/site/wp-blog-header.php(13): require_once('/var/www/site...')
#4 /var/www/site/index.php(17): require('/var/www/site...')
#5 {main}
  thrown in /var/www/site/wp-includes/load.php on line 141'

The error occurs inside the call of wp_check_php_mysql_versions() function.

I've seen that this WP_CONTENT_DIR should be loaded in wp-includes/default-constants.php which is loaded AFTER this call.

Is this a bug in Wordpress ?

1 Answer 1


Yes, this is a bug, but it appear only when the WP configuration is not finished.

The error occurs on this line (in wp-includes/load.php) :

  if ( ! extension_loaded( 'mysql' ) 
       && ! extension_loaded( 'mysqli' ) 
       && ! extension_loaded( 'mysqlnd' ) 
       && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {

This checks that mysql extension is installed, and tries several things for this. The last check will not work because WP_CONTENT_DIR is not defined yet at this stage.

The logical way to fix this is to ignore this error, and install PHP mysql extension, like so (in Debian) :

sudo apt install php-mysql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.