• I’m writing a script to backup wordpress in FreeNas using Bash.
    When I issue the command
    iocage exec wordpress "cd /usr/local/www/wordpress && su -m www -c 'wp maintenance-mode activate'"
    I get these errors but wordpress is put in mantenance mode.

    PHP Notice:  Undefined index: HTTP_X_FORWARDED_PROTO in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code on line 3
    PHP Notice:  Constant AUTH_KEY already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code on line 57
    PHP Notice:  Constant AUTH_SALT already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code on line 61
    Enabling Maintenance mode...
    Success: Activated Maintenance mode.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi there,

    This is due to the defines already being within the **wp-config.php**. You can try appending --skip-plugins and --skip-themes flags to the wp-cli command to have it not show up.

    Kind regards!

    Thread Starter naskar

    (@naskar)

    Still showing the errors

    root@wordpress:/usr/local/www/wordpress # php wp-cli.phar --skip-plugins --skip-themes maintenance-mode activate
    PHP Notice:  Undefined index: HTTP_X_FORWARDED_PROTO in phar:///usr/local/www/wordpress/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code on line 3
    PHP Notice:  Constant AUTH_KEY already defined in phar:///usr/local/www/wordpress/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code on line 57
    PHP Notice:  Constant AUTH_SALT already defined in phar:///usr/local/www/wordpress/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code on line 61
    Enabling Maintenance mode...
    Success: Activated Maintenance mode.
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP notice with CLI Maintenance Mode’ is closed to new replies.