MU-Migration icon indicating copy to clipboard operation
MU-Migration copied to clipboard

Error: Impossible to create the file to export multisite

Open JOY opened this issue 3 years ago • 2 comments

Describe the bug

I got these error when trying to export my multisites:

anh_legiang@grow:/home/grow.vn/public_html$ wp mu-migration export all site.zip --plugins --themes --uploads
PHP Warning:  Version warning: Imagick was compiled against ImageMagick version 1690 but version 1691 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0
PHP Notice:  Undefined index: HTTP_HOST in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1296) : eval()'d code on line 115
PHP Warning:  Use of undefined constant ‘WP_MEMORY_LIMIT’ - assumed '‘WP_MEMORY_LIMIT’' (this will throw an Error in a future version of PHP) in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1296) : eval()'d code on line 120
PHP Warning:  Use of undefined constant ‘256M’ - assumed '‘256M’' (this will throw an Error in a future version of PHP) in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1296) : eval()'d code on line 120
Exporting site meta data...
PHP Warning:  file_put_contents(mu-migration-1611848399grow.json): failed to open stream: Permission denied in /home/anh_legiang/.wp-cli/packages/vendor/10up/mu-migration/includes/commands/class-mu-migration-export.php on line 452
Warning: file_put_contents(mu-migration-1611848399grow.json): failed to open stream: Permission denied in /home/anh_legiang/.wp-cli/packages/vendor/10up/mu-migration/includes/commands/class-mu-migration-export.php on line 452
Exporting users...
PHP Warning:  fopen(mu-migration-1611848399grow.csv): failed to open stream: Permission denied in /home/anh_legiang/.wp-cli/packages/vendor/10up/mu-migration/includes/commands/class-mu-migration-export.php on line 187
Warning: fopen(mu-migration-1611848399grow.csv): failed to open stream: Permission denied in /home/anh_legiang/.wp-cli/packages/vendor/10up/mu-migration/includes/commands/class-mu-migration-export.php on line 187
Error: Impossible to create the file

If I tried to use root:

anh_legiang@grow:/home/grow.vn/public_html$ sudo wp mu-migration export all site.zip --plugins --themes --uploads --allow-root
sudo: unable to resolve host grow: Name or service not known
PHP Warning:  Version warning: Imagick was compiled against ImageMagick version 1690 but version 1691 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0
PHP Notice:  Undefined index: HTTP_HOST in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1296) : eval()'d code on line 115
PHP Warning:  Use of undefined constant ‘WP_MEMORY_LIMIT’ - assumed '‘WP_MEMORY_LIMIT’' (this will throw an Error in a future version of PHP) in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1296) : eval()'d code on line 120
PHP Warning:  Use of undefined constant ‘256M’ - assumed '‘256M’' (this will throw an Error in a future version of PHP) in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1296) : eval()'d code on line 120
Error: 'mu-migration' is not a registered wp command. See 'wp help' for available commands.

Steps to Reproduce

  1. Install MU-Migration
  2. CD to public_html directory
  3. Run the command: wp mu-migration export all site.zip --plugins --themes --uploads

Screenshots, screen recording, code snippet

No response

Environment information

Ubuntu 22.01

WordPress information

6.1

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

JOY avatar Nov 14 '22 15:11 JOY

  1. IMO, bad form on CentOS. They've really done us wrong with the repo aftermath that I've seen over and over again (eg: ImageMagick, Imagick, etc etc)

  2. I'm not 100% certain here, but I'm going to assume the 256M issue is from ‘smart quotes’, and should be '256M' define('WP_MEMORY_LIMIT', '256M'); define('WP_MAX_MEMORY_LIMIT', '512M');

  3. I believe that you'll need to add --blog_id=1 to your command. (If grow.vn is your main site domain, and the one that you're trying to export) If you've already tried that (and/or I missed that), maybe there is an issue with the .vn TLD.

  4. I might be wrong here, but I believe that fopen isn't activated in PHP. (If I am correct, you want that active on php<7.4) I'm thinking that's simply the Warning and not an Error/Failed, but activating fopen should make that Warning go away.

  5. I'm seeing multiple paths: /home/grow.vn/public_html/... /home/anh_legiang/.wp-cli/... ...but, neither of those paths are root. that's why you're not finding the wp-cli command w/ sudo. If you're going to try root, I'd suggest installing the package on the root account.

  6. If you're going to use root, I'd suggest using the actual root account and not sudo. IMO, the --allow-root tag keeps me straight, while sudo might lead to an addtl level of confusion.

splaquet avatar Nov 14 '22 16:11 splaquet

I'm using Ubuntu.

Add --blog_id=1 doesn't work. I installed the package on root account.

anh_legiang@grow:/home/grow.vn/public_html$ wp mu-migration export all site.zip --plugins --themes --uploads --blog_id=1
PHP Warning:  Version warning: Imagick was compiled against ImageMagick version 1690 but version 1691 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0
PHP Notice:  Undefined index: HTTP_HOST in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1296) : eval()'d code on line 115
PHP Warning:  Use of undefined constant ‘WP_MEMORY_LIMIT’ - assumed '‘WP_MEMORY_LIMIT’' (this will throw an Error in a future version of PHP) in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1296) : eval()'d code on line 120
PHP Warning:  Use of undefined constant ‘256M’ - assumed '‘256M’' (this will throw an Error in a future version of PHP) in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1296) : eval()'d code on line 120
Exporting site meta data...
PHP Warning:  file_put_contents(mu-migration-1111988431grow.json): failed to open stream: Permission denied in /home/anh_legiang/.wp-cli/packages/vendor/10up/mu-migration/includes/commands/class-mu-migration-export.php on line 452
Warning: file_put_contents(mu-migration-1111988431grow.json): failed to open stream: Permission denied in /home/anh_legiang/.wp-cli/packages/vendor/10up/mu-migration/includes/commands/class-mu-migration-export.php on line 452
Exporting users...
PHP Warning:  fopen(mu-migration-1111988431grow.csv): failed to open stream: Permission denied in /home/anh_legiang/.wp-cli/packages/vendor/10up/mu-migration/includes/commands/class-mu-migration-export.php on line 187
Warning: fopen(mu-migration-1111988431grow.csv): failed to open stream: Permission denied in /home/anh_legiang/.wp-cli/packages/vendor/10up/mu-migration/includes/commands/class-mu-migration-export.php on line 187
Error: Impossible to create the file

JOY avatar Nov 14 '22 16:11 JOY