WordPress Toolkit Cloning hangs or stops on a Plesk server | Fix it today
WordPress Toolkit Cloning hangs or stops on a Plesk server? We have a solution for you.
At Bobcares, we offer solutions for every query, big and small, as a part of our
Let’s take a look at how our
Why does WordPress Toolkit Cloning hang or stop on a Plesk server?
Have you been facing trouble while attempting to use the WordPress Toolkit Cloning feature? Our Support Team has been helping out customers who find themselves facing an error similar to the one below:
WP-CLI command has not finished working in 60 seconds, so it was terminated. Usually this means that there are problems with WordPress instance WordPress instance #12 ('https://staging.example.com') itself, for example it could be infected with malware. Check the wp-config.php file of the instance for potential malware code.
Moreover, we can find the error messages in the /var/log/plesk/panel.log file:
[2021-10-09 19:24:03.957] ERR  '/usr/local/psa/admin/bin/filemng' 'jdoe' 'exec' '/var/www/vhosts/example.com/staging.example.com' '/opt/plesk/php/7.2/bin/php' '-d' 'safe_mode=off' '-d' 'display_errors=off' '-d' 'opcache.enable_cli=off' '-d' 'open_basedir=' '-d' 'error_reporting=341' '-c' '/var/www/vhosts/system/staging.example.com/etc/php.ini' '/usr/local/psa/admin/plib/modules/wp-toolkit/vendor/wp-cli/wp-cli/php/boot-fs.php' '--path=/var/www/vhosts/example.com/staging.example.com' 'search-replace' 'https://example.com' 'https://staging.example.com' '--precise' '--all-tables' failed with code 15.
In this scenario, we will also notice that the PHP handler of the main domain of the subscription is usually either PHP 7.2 or 7.3.
According to our
How to resolve “WordPress Toolkit Cloning hangs or stops on a Plesk server”
Fortunately, there are two workarounds to resolve this specific issue:
- Via Plesk Web interface
- Via command-line (SSH) or RDP (for Windows)
Via Plesk web interface
- First, log in to Plesk.
- Then, we will create the subdomain where we want to clone the instance. For instance, it is staging.example.com in this scenario.
- Next, we will navigate to PHP Settings under staging.example.com in the Domains section. Then, we will switch to PHP version to 7.1 in this example.
- After that, we will head to Clone under example.com in WordPress. Here we will select Use existing domain or subdomain and choose the new domain staging.example.com as the Target. We can opt to change the database name here.
- Finally, once the cloning is over, we will head to PHP Settings under staging.example.com in the Domains section and switch back to PHP version 7.2.
Via command line
In case the cloning procedure fails, we can still resolve the issue through the command line. Our
Workaround via SSH
- First, we will connect to the server via SSH.
- Then we have to create the subdomain where we want to clone the instance with this command:
# plesk bin subdomain --create staging -domain example.com -www-root /staging.example.com -empty-document-root true
If the target instance is not the subdomain of the source instance, we have to run the following command:
# plesk bin site --create staging.example.com -webspace-name example.com -hosting true -www-root /staging.example.com -empty-document-root true
- Next, we have to copy the files to the target folder from the source folder with this command:
# cp -pr /var/www/vhosts/example.com/httpdocs/* /var/www/vhosts/example.com/staging.example.com/
- After that, we have to replace the source URL with the target URL:
# for i in $(grep -rl "example.com" /var/www/vhosts/example.com/staging.example.com/); do sed -i "s/example.com/staging.example.com/g" $i; done
- Then, we will find the source database details as seen below:
# cat /var/www/vhosts/example.com/httpdocs/wp-config.php | egrep 'DB_NAME|DB_USER|DB_PASSWORD|DB_HOST' define('DB_NAME', 'example-db'); define('DB_USER', 'wp_abcdef'); define('DB_PASSWORD', 'pa$$w0rd'); define( 'DB_HOST', 'localhost:3306' );
- Next, we will make a dump of the database with the following command:
# mysqldump -u wp_abcdef -p example-db -h localhost > example-db.sql
- After that we will replace the strings example.com with staging.example.com in the dump:
# sed -i 's/example.com/staging.example.com/g' example-db.sql
- Then, we will create a new database for the target as well as a user for this database with the following commands:
# plesk bin database --create example-stg -domain example.com -server localhost:3306 # plesk bin database --create-dbuser stg-example -passwd "MyPass" -domain example.com -server localhost:3306 -database example-stg
- Now, we have to edit the /var/www/vhosts/example.com/staging.example.com/wp-config.php and change the values of DB_USER, DB_NAME, and DB_PASSWORD according to the previous step:
# cat /var/www/vhosts/example.com/staging.example.com/wp-config.php | egrep 'DB_NAME|DB_USER|DB_PASSWORD' define('DB_NAME', 'example-stg'); define('DB_USER', 'stg-example'); define('DB_PASSWORD', 'MyPass');
- Finally, we have to insert the dump into the newly created database example-stg:
# mysql -u stg-example -p example-stg < example-db.sql
Workaround via RDP
- First, we have to connect to the server via RDP.
- Then we will create the staging subdomain as seen below:
C:> plesk bin subdomain --create staging -domain example.com -www-root /staging.example.com -empty-document-root true
However, if the target instance is not the subdomain of the source instance, we will run the following command instead:
C:> plesk bin site --create staging.example.com -webspace-name example.com -hosting true -www-root /staging.example.com -empty-document-root true
- Next, we will copy the files from the target folder to the source folder. For instance, from C:inetpubvhostsexample.comhttpdocs to C:inetpubvhostsexample.comstaging.example.com.
- Then, we will open the wp-config.php file in the document root of the domain we copied. After that, we will replace the source URL with the target URL. We can find the source database details with this command:
define('DB_NAME', 'example-db'); define('DB_USER', 'wp_abcdef'); define('DB_PASSWORD', 'pa$$w0rd'); define( 'DB_HOST', 'localhost:3306' );
- After that, we have to create a dump of the source database via Export Dump under example-db in Databases, followed by example.com in Domains.
- Then we will open the database dump via a text editor and replace all ‘example.com’ with ‘staging.example.com’ as seen below:
- Then, we have to create a new database as well as a database user for the target domain under Domains in staging.examples.com in the Databases section.
- Next. We will edit the C:inetpubvhostsexample.comstaging.example.comwp-config.php file and change the values of DB_USER, DB_NAME, and DB_PASSWORD according to the previous step:
define('DB_NAME', 'example-stg'); define('DB_USER', 'stg-example'); define('DB_PASSWORD', 'MyPass');
- Finally, we will import the dump into the new database via Domains > staging.example.com > Databases > example-stg > Import Dump.
[Looking for a solution to another query?
In essence, the skilled