Home » WP CLI Update Issues

WP CLI Update Issues

Recently when trying to update WordPress using WP CLI I ran into two errors

Permisssions Issue

The Default installation of WordPress on ubuntu is executed under www-data user its Apache its the web server being used. Running update with sudo asa well ass without sudo is likely to yield error. Use the following command

sudo -u www-data wp core update

Divi Toolbox error

Initially when running the command, ihaad an error

wp core check-update PHP Fatal error: Uncaught TypeError: ftp_nlist(): Argument #1 ($ftp) must be of type resource, null given in /var/www/html/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php:420 Stack trace: #0 /var/www/html/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php(420): ftp_nlist() #1 /var/www/html/wordpress/wp-content/plugins/divi-toolbox/functions/settings/static-css.php(25): WP_Filesystem_FTPext->exists() #2 /var/www/html/wordpress/wp-content/plugins/divi-toolbox/divi-toolbox.php(79): dtb_get_static_css_path() #3 /var/www/html/wordpress/wp-includes/class-wp-hook.php(292): dtb_toolbox_init() #4 /var/www/html/wordpress/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters() #5 /var/www/html/wordpress/wp-includes/plugin.php(484): WP_Hook->do_action() #6 /var/www/html/wordpress/wp-settings.php(423): do_action() #7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1271): require('...') #8 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1192): WP_CLI\Runner->load_wordpress() #9 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start() #10 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(77): WP_CLI\Bootstrap\LaunchRunner->process() #11 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(27): WP_CLI\bootstrap() #12 phar:///usr/local/bin/wp/php/boot-phar.php(11): include('...') #13 /usr/local/bin/wp(4): include('...') #14 {main} thrown in /var/www/html/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php on line 420 Fatal error: Uncaught TypeError: ftp_nlist(): Argument #1 ($ftp) must be of type resource, null given in /var/www/html/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php:420 Stack trace: #0 /var/www/html/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php(420): ftp_nlist() #1 /var/www/html/wordpress/wp-content/plugins/divi-toolbox/functions/settings/static-css.php(25): WP_Filesystem_FTPext->exists() #2 /var/www/html/wordpress/wp-content/plugins/divi-toolbox/divi-toolbox.php(79): dtb_get_static_css_path() #3 /var/www/html/wordpress/wp-includes/class-wp-hook.php(292): dtb_toolbox_init() #4 /var/www/html/wordpress/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters() #5 /var/www/html/wordpress/wp-includes/plugin.php(484): WP_Hook->do_action() #6 /var/www/html/wordpress/wp-settings.php(423): do_action() #7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1271): require('...') #8 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1192): WP_CLI\Runner->load_wordpress() #9 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start() #10 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(77): WP_CLI\Bootstrap\LaunchRunner->process() #11 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(27): WP_CLI\bootstrap() #12 phar:///usr/local/bin/wp/php/boot-phar.php(11): include('...') #13 /usr/local/bin/wp(4): include('...') #14 {main} thrown in /var/www/html/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php on line 420

Line 1 shows the location of error. Deactivating Divi Toolbox fixed the issue and I was able to update successfully