• shaunek

    (@shaunek)


    I just upgraded our servers from PHP 7.4 to PHP 8.2 and our frontend and admin screens are working okay, no noisy warnings, but when I use the wp-cli provided by my host (Cloudways) I’m getting lots of warnings. Here is a portion of the warnings I’m getting when I run ANY wp-cli command. You’ll notice that basically every constant that is defined my wp-config.php gets two lines of warnings.

    myuser@333333 ~/public_html $ wp eval --skip-themes "var_dump(WP_DEBUG);"
    PHP Warning: Constant WP_CACHE already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 3
    Warning: Constant WP_CACHE already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 3
    PHP Warning: Constant WP_CACHE_KEY_SALT already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 4
    Warning: Constant WP_CACHE_KEY_SALT already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 4
    PHP Warning: Constant DB_NAME already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 42
    Warning: Constant DB_NAME already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 42
    PHP Warning: Constant DB_USER already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 46
    Warning: Constant DB_USER already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 46
    PHP Warning: Constant DB_PASSWORD already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 50
    Warning: Constant DB_PASSWORD already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 50
    PHP Warning: Constant DB_HOST already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 54
    Warning: Constant DB_HOST already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 54
    PHP Warning: Constant DB_CHARSET already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 58
    Warning: Constant DB_CHARSET already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 58
    PHP Warning: Constant DB_COLLATE already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 62
    Warning: Constant DB_COLLATE already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 62
    PHP Warning: Constant AUTH_KEY already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 10
    Warning: Constant AUTH_KEY already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 10
    PHP Warning: Constant SECURE_AUTH_KEY already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 11
    Warning: Constant SECURE_AUTH_KEY already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 11
    PHP Warning: Constant LOGGED_IN_KEY already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 12
    Warning: Constant LOGGED_IN_KEY already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 12
    PHP Warning: Constant NONCE_KEY already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 13
    Warning: Constant NONCE_KEY already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 13
    PHP Warning: Constant AUTH_SALT already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 14
    Warning: Constant AUTH_SALT already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 14
    PHP Warning: Constant SECURE_AUTH_SALT already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 15
    Warning: Constant SECURE_AUTH_SALT already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 15
    PHP Warning: Constant LOGGED_IN_SALT already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 16
    Warning: Constant LOGGED_IN_SALT already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 16
    PHP Warning: Constant NONCE_SALT already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 17
    Warning: Constant NONCE_SALT already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-salt.php on line 17
    PHP Warning: Constant FS_METHOD already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 118
    Warning: Constant FS_METHOD already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 118
    PHP Warning: Constant WPLANG already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 120
    Warning: Constant WPLANG already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 120
    PHP Warning: Constant FS_CHMOD_DIR already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 122
    Warning: Constant FS_CHMOD_DIR already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 122
    PHP Warning: Constant FS_CHMOD_FILE already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 124
    Warning: Constant FS_CHMOD_FILE already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 124
    PHP Warning: Constant DISABLE_WP_CRON already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 143
    Warning: Constant DISABLE_WP_CRON already defined in /home/333333.cloudwaysapps.com/myuser/public_html/wp-config.php on line 143

    For clarity, these warnings are not emitted when I have the server configured to use PHP 7.4, it only started when I upgraded the server to PHP 8.2.

    I’ve definitively narrowed the noisy offending plugin down to wp-security-hardening by using the wp-cli’s “–skip-plugins” option, so I get these warnings every time until I run it with –skip-plugins=wp-security-hardening.

    In terms of environment that I’m running, my host is Cloudways and the WP-CLI executable is provided by the hosting provider and the version of it is WP-CLI 2.9.0.

Viewing 1 replies (of 1 total)
  • Thread Starter shaunek

    (@shaunek)

    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");

    When I comment those lines out the warnings I’m complaining about go away.

    Does anybody know why the plugin needs to require these two files here? It seems like it works without these lines.

Viewing 1 replies (of 1 total)
  • The topic ‘PHP Warnings after upgrading to PHP 8.2’ is closed to new replies.