Plesk

WP Toolkit Cloning hangs or stops after 60 seconds on a Plesk server

Symptoms

Cause

Issue in the function `search-replace` from WP-CLI utility in combination with PHP 7.2 & 7.3.

Resolution

Two workarounds are possible:

Via Plesk web interface

  1. Log into Plesk.

  2. Create the subdomain where to clone the instance (E.G: staging.example.com).

  3. Go to Domains > staging.example.com > PHP Settings and switch PHP version to 7.1 for example.

  4. Go to WordPress > example.com > Clone
    Check Use existing domain or subdomain and select the new domain staging.example.com as Target in the list, the database name can be optionally changed.

  5. Once cloning finishes, go again to Domains (Or as customer: Websites & Domains) > staging.example.com > PHP Settings and switch back the PHP version to 7.2.

If cloning still fails, clone WordPress manually:

Via command line (SSH)

  1. Connect to the server via SSH.

  2. Create the subdomain where to clone the instance (E.G: staging.example.com):

    # plesk bin subdomain --create staging -domain example.com -www-root /staging.example.com -empty-document-root true

    Note: In case the target instance is not a subdomain of the source instance, run this command instead:

    # plesk bin site --create staging.example.com -webspace-name example.com -hosting true -www-root /staging.example.com -empty-document-root true

  3. Copy the files from the source instance to the target folder:

    # cp -pr /var/www/vhosts/example.com/httpdocs/* /var/www/vhosts/example.com/staging.example.com/

  4. Replace the source URL by the target URL in all these files:

    # 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

  5. Find the source database details:

    # cat /var/www/vhosts/example.com/httpdocs/wp-config.php | egrep 'DB_NAME|DB_USER|DB_PASSWORD|DB_HOST'
    define('DB_NAME', 'example-db…