0

Bringing this over from the wp-cli github page. I've been searching here, the docs, and the webs for several hours. Currently hosting with Blue Host and they are using version 1.2.0 :( I can't seem to update. I have 3 wp pages that work "perfectly" fine, but one other just won't connect to the db.

I can log in to db with same credentials as wp-config.php, cleaned up db, still no luck.

Any thoughts on this? Trying to ultimately maintain these pages better through wp-cli. Thanks

wp core version: returns fine.

wp config path --debug
Debug (bootstrap): No readable global config found (0.267s)
Debug (bootstrap): No project config found (0.268s)
Debug (bootstrap): ABSPATH defined: /home/public_html/domain/ (0.269s)
Debug (bootstrap): Begin WordPress load (0.269s)
Debug (bootstrap): wp-config.php path: /home/public_html/domain/wp-config.php (0.269s)
Notice: Use of undefined constant DB_USER - assumed 'DB_USER' in /home/public_html/domain/wp-includes/load.php on line 404
Notice: Use of undefined constant DB_PASSWORD - assumed 'DB_PASSWORD' in /home/public_html/domain/wp-includes/load.php on line 404
Notice: Use of undefined constant DB_NAME - assumed 'DB_NAME' in /home/public_html/domain/wp-includes/load.php on line 404
Notice: Use of undefined constant DB_HOST - assumed 'DB_HOST' in /home/public_html/domain/wp-includes/load.php on line 404
Notice: Undefined variable: table_prefix in /home/public_html/domain/wp-settings.php on line 109
Error: Error establishing a database connection. This either means that the username and password information in your `wp-config.php` file is incorrect or we can’t contact the database server at `DB_HOST`. This could mean your host’s database server is down.

wp-config.php:

<?php
/**
 * The base configurations of the WordPress.
 *
 * This file has the following configurations: MySQL settings, Table Prefix,
 * Secret Keys, WordPress Language, and ABSPATH. You can find more information
 * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
 * wp-config.php} Codex page. You can get the MySQL settings from your web host.
 *
 * This file is used by the wp-config.php creation script during the
 * installation. You don't have to use the web site, you can just copy this file
 * to "wp-config.php" and fill in the values.
 *
 * @package WordPress
 */

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'dbname');

/** MySQL database username */
define('DB_USER', 'dbuser');

/** MySQL database password */
define('DB_PASSWORD', 'pass');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define('AUTH_KEY',         '');
define('SECURE_AUTH_KEY',  '');
define('LOGGED_IN_KEY',    '');
define('NONCE_KEY',        '');
define('AUTH_SALT',        '');
define('SECURE_AUTH_SALT', '');
define('LOGGED_IN_SALT',   '');
define('NONCE_SALT',       '');

/**#@-*/

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each a unique
 * prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = 'wps_';

/**
 * WordPress Localized Language, defaults to English.
 *
 * Change this to localize WordPress. A corresponding MO file for the chosen
 * language must be installed to wp-content/languages. For example, install
 * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
 * language support.
 */
define('WPLANG', '');

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 */
define('WP_DEBUG', false);

define( 'AUTOSAVE_INTERVAL', 300 );
define( 'WP_POST_REVISIONS', 5 );
define( 'EMPTY_TRASH_DAYS', 7 );
define( 'WP_CRON_LOCK_TIMEOUT', 120 );
/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

1 Answer 1

1

It looks like the problem was the wp-config.php

Though not sure what. I copied the content of wp-config-sample.php while keeping the same db credentials and it started working. I then reverted the changes and it is still working...

Only differences were:

Initially, when replacing the file, the Salts were not set.

And hese lines...

define( 'AUTOSAVE_INTERVAL', 300 );
define( 'WP_POST_REVISIONS', 5 );
define( 'EMPTY_TRASH_DAYS', 7 );
define( 'WP_CRON_LOCK_TIMEOUT', 120 );

If it comes back I'll look at the 4 defines... Hope this helps somebody, I was ripping my hairs out of my head!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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