I am trying to export a remote wp db using the following:


ssh -p22 -i $connecting_keyfile $source_ssh_user@$source_ssh_host  'cd public_html && bash' << EOF

    php wp-cli.phar db export --exclude_tables=wp_,wp_, --path=$source_path_to_wordpress - | gzip > $source_path_to_wordpress$source_gzip_db


where $source_path_to_wordpress is /home/username/public_html

But I keep getting the following error:

Error: This does not seem to be a WordPress installation.
Pass --path=`path/to/wordpress` or run `wp core download`.

Any tips?

  • Can you make it work hard-coding the $source_path_to_wordpress in the >>> section? I'm not sure how expansion works with >>> sections. Does the variable exist on this system or the system you're SSHing into?
    – Rup
    Sep 19, 2022 at 7:55
  • @Rup thx for your feedback...I added the variable valuables above... but your comment gave me a pretty good idea of whats wrong. I run this script on a different server where the username of remote and local are the same (therefore all paths are the same). However, for the above the usernames are different between remote and local (different paths) so the script can't find the variables. I believe my solution is to create a remote script with variables and paths & use my ssh command above to execute that script remotely. that should get me my exported db.... will post answer, if successful
    – mjones
    Sep 19, 2022 at 9:21


Your Answer

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

Browse other questions tagged or ask your own question.