Title: PHP Warnings when using WP-CLI
Last modified: May 10, 2024

---

# PHP Warnings when using WP-CLI

 *  [Tommy Ferry](https://wordpress.org/support/users/tferry/)
 * (@tferry)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/php-warnings-when-using-wp-cli/)
 * Hi,
 * This plugin causes lots of PHP warnings when using the WP-CLI:
 *     ```wp-block-code
       PHP Warning: Constant DB_NAME already defined in [...]/public/wp-config.php on line 25
       Warning: Constant DB_NAME already defined in [...]/public/wp-config.php on line 25
       PHP Warning: Constant DB_USER already defined in [...]/public/wp-config.php on line 28
       Warning: Constant DB_USER already defined in [...]/public/wp-config.php on line 28
       PHP Warning: Constant DB_PASSWORD already defined in [...]/public/wp-config.php on line 31
       Warning: Constant DB_PASSWORD already defined in [...]/public/wp-config.php on line 31
       PHP Warning: Constant DB_HOST already defined in [...]/public/wp-config.php on line 34
       Warning: Constant DB_HOST already defined in [...]/public/wp-config.php on line 34
       PHP Warning: Constant DB_CHARSET already defined in [...]/public/wp-config.php on line 37
       Warning: Constant DB_CHARSET already defined in [...]/public/wp-config.php on line 37
       PHP Warning: Constant DB_COLLATE already defined in [...]/public/wp-config.php on line 40
       Warning: Constant DB_COLLATE already defined in [...]/public/wp-config.php on line 40
       PHP Warning: Constant AUTH_KEY already defined in [...]/public/wp-config.php on line 51
       Warning: Constant AUTH_KEY already defined in [...]/public/wp-config.php on line 51
       PHP Warning: Constant SECURE_AUTH_KEY already defined in [...]/public/wp-config.php on line 52
       Warning: Constant SECURE_AUTH_KEY already defined in [...]/public/wp-config.php on line 52
       PHP Warning: Constant LOGGED_IN_KEY already defined in [...]/public/wp-config.php on line 53
       Warning: Constant LOGGED_IN_KEY already defined in [...]/public/wp-config.php on line 53
       PHP Warning: Constant NONCE_KEY already defined in [...]/public/wp-config.php on line 54
       Warning: Constant NONCE_KEY already defined in [...]/public/wp-config.php on line 54
       PHP Warning: Constant AUTH_SALT already defined in [...]/public/wp-config.php on line 55
       Warning: Constant AUTH_SALT already defined in [...]/public/wp-config.php on line 55
       PHP Warning: Constant SECURE_AUTH_SALT already defined in [...]/public/wp-config.php on line 56
       Warning: Constant SECURE_AUTH_SALT already defined in [...]/public/wp-config.php on line 56
       PHP Warning: Constant LOGGED_IN_SALT already defined in [...]/public/wp-config.php on line 57
       Warning: Constant LOGGED_IN_SALT already defined in [...]/public/wp-config.php on line 57
       PHP Warning: Constant NONCE_SALT already defined in [...]/public/wp-config.php on line 58
       Warning: Constant NONCE_SALT already defined in [...]/public/wp-config.php on line 58
       PHP Warning: Constant WP_CACHE_KEY_SALT already defined in [...]/public/wp-config.php on line 59
       Warning: Constant WP_CACHE_KEY_SALT already defined in [...]/public/wp-config.php on line 59
       ```
   
 * It looks like the cause of this has already been raised in a previous ticket 
   but I’m not able to join that conversation:
 * > I believe I have partially figured out what is going on, the /modules/hooks.
   > php file has this code at the top:
   > `require_once(ABSPATH."/wp-includes/pluggable.php");
   > require_once(ABSPATH."/
   > wp-load.php");
   >  [https://wordpress.org/support/topic/php-warnings-after-upgrading-to-php-8-2/](https://wordpress.org/support/topic/php-warnings-after-upgrading-to-php-8-2/)
 * This makes using the WP-CLI very noisy and much harder to use so it should definitely
   be fixed.
 * Thanks

Viewing 1 replies (of 1 total)

 *  [shaunek](https://wordpress.org/support/users/shaunek/)
 * (@shaunek)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/php-warnings-when-using-wp-cli/#post-18105772)
 * I’m curious if you figured out the best way to patch this plugin to avoid this
   problem?

Viewing 1 replies (of 1 total)

The topic ‘PHP Warnings when using WP-CLI’ is closed to new replies.

 * ![](https://ps.w.org/wp-security-hardening/assets/icon-256x256.jpg?rev=3115655)
 * [WP Hardening (discontinued)](https://wordpress.org/plugins/wp-security-hardening/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-security-hardening/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-security-hardening/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-security-hardening/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-security-hardening/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-security-hardening/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [shaunek](https://wordpress.org/support/users/shaunek/)
 * Last activity: [1 year, 5 months ago](https://wordpress.org/support/topic/php-warnings-when-using-wp-cli/#post-18105772)
 * Status: not resolved