[Resolved] Cloning localhost installation to another localhost installation

Home Forums Support [Resolved] Cloning localhost installation to another localhost installation

Home Forums Support Cloning localhost installation to another localhost installation

  • This topic has 23 replies, 4 voices, and was last updated 7 years ago by Tom.
Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #261191
    NBC

    GP 1.3.41 and GP Premium 1.2.92 under WP 4.7. Apologies if this is TL;DR, but I am at my wits’ end at this point.

    I’ve spent an entire day in a fruitless quest for a way to clone a localhost site to another localhost installation. I’ve finished setting up the basic site and before I add BuddyPress or BBPress to it, I want to save it as it is as a fallback position.

    Suppose that localhost:8888/aa/ is the path to my original version of this site.

    Suppose I now want to create a clone at localhost:8888/ab/

    I’ve tried every cloning/duplicating plug-in I can find, except for one that only installs to a subdirectory of the original site.
    WP-Staging
    Darwin-Backup
    WP-Clone by WP-Academy
    Duplicator
    Duplicator-Clone

    I’ve tried the manual method, editing a backup of my database to point to the new location, importing the data to a new db, and copying over the wp-content folder.
    WP DBManager
    WP DB-Backup

    I am not exporting my GP/Premium settings and importing them into the clone site because they should be in the database, which is coming along for the ride in the backup.

    In each case, the result is the same: A blank screen on the site and on the dashboard once the cloning process is complete.

    Is there any way to duplicate from localhost to localhost? What the heck am I missing?

    #261293
    Tom
    Lead Developer
    Lead Developer

    I usually just use Duplicator.

    If you’re getting a white screen, it means there’s an error happening. Check your error_log (or equivalent) for more details on the error.

    #261419
    NBC

    I tried Duplicator again. The copy of the site loads, but the WP admin dashboard will not load. All I get is a blank screen.

    <sigh>

    Maybe the plug-in doesn’t work going from a localhost site to another localhost installation.

    Thanks again, Tom!

    #261457
    Lyle

    NBC,

    Here is a sure fire way to do it with no fuss and no muss πŸ™‚

    On the site you want to clone, install and activate the All In One Migration (AIOM) plugin. Then select Dashboard > All In One Migration > Export and select File. It will chug away for a bit and then pop up a dialog where you click the pulsing Download button πŸ™‚ This “downloads” (saves) the export file to wherever your downloads are located.

    Then set up a brand new, default WordPress installation on your localhost. Once that is done, install and activate AIOM plugin. This time, select Import > File and select the file you exported above. It will chug away for a bit and ask for confirmations in a dialog or two, which you accept, and then it will finish by asking you to re-save your permalinks twice. Clicking on any of the links will log you out, which is what is supposed to happen. Log back in and go to Settings > Permalinks and click the Save Changes button twice, waiting for it to do so before you click it the second time πŸ™‚

    That’s it! Done πŸ™‚

    I have not had this fail on many site moves/copies, etc. whether local or live. The nice thing about AIOM is that it handles updating the URLs without any intervention πŸ™‚

    Cheers!
    Lyle

    #261622
    NBC

    Hi, Lyle:

    I tried AIO Optimizer.

    Everything went as expected until it reached “Done restoring database.”

    Two hours later, it was still stuck. I had to force quit.

    Tried twice. Same results both times.

    Really simple site. GP/GP Premium, child theme with one bit of CSS in it.

    Installed plug-ins are as follows:
    All-in-one WP Migration
    Rename Media Files
    Autoptimize (inactive)
    BBPress (active but not configured yet)
    BuddyPress (active but not configured yet)
    Contact Form 7
    Duplicate Post
    Easy Facebook Likebox
    GP Premium
    Loginpress
    Regenerate Thumbnails

    I am so far beyond frustrated at this point that it’s bordering on absurd. All I want is a clone of the current state of the site so I can start configuring BBPress and BuddyPress. I want a fallback position in case the client decides not to opt for the additional features.

    #261641
    Tom
    Lead Developer
    Lead Developer

    All I can think of is that your localhost has some sort of setting on it causing issues with these migration plugins. There isn’t any reason they shouldn’t work (they have millions of active installs combined).

    Maybe try creating a folder on one of your live servers and move the site there instead of to another folder on your localhost.

    #261672
    Lyle

    NBC,

    Sorry to hear that AIOM did not work. As Tom mentioned, there must be something “up” with your local server.

    That said, and going by the url you initially provided, can you confirm you are using MAMP on a Mac with the default MAMP settings for the ports?

    Your original post indicated that you tried a manual copy; that should always work πŸ™‚

    – source site:
    — from phpMyAdmin, export the database (use the default settings … just select it from the list on the left and click the Export tab and then GO)

    – new site
    — in phpMyAdmin create a new, empty db and import the file you just exported
    — edit the home and siteurl fields in the wp_options table with the new location (I will continue to use your example … http://localhost:8888/ab )
    — select and copy ALL the files and folders in /htdocs/aa and paste them into /htdocs/ab
    — edit the wp-config.php file in the /ab folder to change the db name; the other items should be the same

    This will (should) let you log into the backend of the new site. Once there, install and run this plugin:

    https://wordpress.org/plugins/better-search-replace/

    – Dashboard > Tools > Better Search/Replace
    – in your case, use: Search for = http://localhost:8888/aa Replace with = http://localhost:8888/ab
    – select all the db tables
    – un-check Run as dry run? and click Run Search/Replace
    – once that is completed, then Settings > Permalinks > Save Changes (just click Save Changes – this rebuilds the .htaccess file

    That should do it πŸ™‚ I’ve done it this way literally 100s of times πŸ™‚

    #261681
    NBC

    Yes, I’m using MAMP 1.9.6. Apache is at port 8888 and MySQL at port 8889. PHP version is 5.3.5. The document root is at /Users/[username]/Sites/wordpress, with my dev folders hanging off that path.

    This struggle has taken me aback, especially because I’ve moved sites from this same localhost installation to live multiple times before. I’ve just never tried to “move” (that is, clone) from localhost to localhost.

    I can’t upgrade beyond this version of MAMP on the system I’m using, which runs Mac OS X version 10.5.8 Leopard. (Can’t afford newer hardware, which is what it would take for me to go beyond these versions.)

    #261695
    Lyle

    That is really odd. I just did a “clone” on my Mac Mini, 10.11.6, and MAMP 4.0.6, and it went according to plan πŸ™‚

    Are you also getting the blank screen after a manual copy?

    #261699
    NBC

    Yes, I just tried the manual process again and got a blank screen when I tried to load
    http://localhost:8888/mc/wp-admin

    (The original site’s in a folder named cm and the “clone” is going into a folder called mc. My original example was simplified to make the paths easier to follow.)

    I wound up editing the .sql file in BBEdit because I don’t trust myself to remember SQL queries after as many years as its been. Couldn’t find an easy edit process in PHPMyAdmin.

    #261746
    Tom
    Lead Developer
    Lead Developer

    Did you ever find your error_log to see if any errors are being output? A blank screen is usually an error that isn’t showing but would be added to your error_log file.

    #261812
    NBC

    The MAMP MySQL log file is empty.

    The PHP and Apache log files do list some error messages.

    In the PHP error log, there are a zillion instances of this:
    [[DATE] [TIME]] PHP Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 311296 bytes) in /Users/[USERNAME]/Sites/wordpress/[CLONEFOLDER]/wp-content/themes/generatepress/inc/customizer.php on line 728

    Sometimes the “Tried to allocate” size varies: 144, 77824, 24, 19456.
    The line number also changes. Usually it’s 728. Sometimes it’s 289, 349, 588, 760, 1346, etc. There’s a long string of these errors in quick succession, a few seconds apart.

    In the Apache error log, I see this associated with my attempts to clone via WP plug-ins.
    [[DATE] [TIME]] [error] [client ::1] script ‘/Users/[USERNAME]/Sites/wordpress/index.php’ not found or unable to stat, referer: http://localhost:8888/%5BCLONEFOLDER%5D/

    That path is my localhost path. All that’s in that folder are the individual folders that contain my dev sites. IOW, there are no files in the folder /Users/[USERNAME]/Sites/wordpress/

    #261877
    Tom
    Lead Developer
    Lead Developer

    You should increase your memory limit to stop the first error – that might be the blank page: https://docs.generatepress.com/article/increasing-php-memory-limit/

    Not sure what the second error is. I guess it’s looking for index.php in a folder where it doesn’t exist. Maybe the cloning plugins are looking in the wrong folder to grab the site.

    #261885
    NBC

    I followed your memory-limit recommendations on the original site. I still get a JavaScript error message when the customizer loads, but if I click on the “Continue” button, it finishes. It did the same thing before I increased the memory limit.

    #261886
    NBC

    And I can see why that second error message didn’t make sense. That “%5BCLONEFOLDER%5D/” was my attempt to put the placeholder “[CLONEFOLDER]” in the URL.

Viewing 15 posts - 1 through 15 (of 24 total)
  • You must be logged in to reply to this topic.