In order to upgrade CiviCRM for WordPress from the command line on a remote server, I just installed wp-cli following the instructions at https://wp-cli.org/.

When I execute:

wp civicrm upgrade --zipfile ../Downloads/civicrm-5.48.0-wordpress.zip 

I get a warning and an error:

Warning: file_get_contents(/home/myhome/www/wp-content/plugins/civicrm/wp-cli//civicrm.settings.php): failed to open stream: No such file or directory in /home/myhome/www/wp-content/plugins/civicrm/wp-cli/civicrm.php on line 946

The upgrade process involves - 
1. Backing up current CiviCRM code as => /home/myhome/www/../backup/plugins/20220412055134/civicrm
2. Backing up database as => /home/myhome/www/../backup/plugins/20220412055134/civicrm.sql
3. Unpacking tarfile to => /home/myhome/www/wp-content/plugins/
4. Executing civicrm/upgrade?reset=1 just as a browser would.

Do you really want to continue? [y/n] y

Success: 1. Code backed up.
mysqldump: Got error: 2002: "Can't connect to MySQL server on 'myftpuser-001.privatesql' (115)" when trying to connect

I wonder if someone could give me an idea of a workaround for this problem.

  • 1
    I concur, this has failed for me as well. I use an external file to get wp-cli to use civicrm from a different location since as soon as we remove the plugin we lose the needed file. But I see this fails on 5.48.0. Can you report an issue at lab.civicrm.org/dev/wordpress/-/issues Apr 12, 2022 at 13:22

1 Answer 1


Following up on the comment from Kevin Cristiano above, the WP-CLI commands for upgrade and restore seem to be broken in versions of CiviCRM since the civicrm.settings.php file was moved out of the CiviCRM plugin directory. Let's track progress on the issue you opened and leave this here as a signpost for others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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