Link to home
Create AccountLog in
Avatar of Tessando
TessandoFlag for United States of America

asked on

Wordpress Migration from hosting to Fresh LAMP stack

I've been tasked with migrating a Wordpress site from a hosting company to Amazon Web Services. I'm pretty familiar with AWS, but Wordpress not so much (medium, lets say). This site is going to use the same domain name, but on a different server.

Today I build a LAMP stack from scratch and have successfully tested Apache, MySQL and PHP.

I have a compressed copy of the website along with the MySQL Database.

Can I just copy the contents of that zipped folder and MySQL to the new LAMP stack? (e.g use wget to dump the root contents, like the "wp-contents" folder into the /var/www/html root, etc. )

If anyone has a good recipe for this, I'd love to read it.

Thanks for your help.
Avatar of Gregory Miller
Gregory Miller
Flag of United States of America image

I would do an install of WordPress on the new LAMP Stack and then copy everything in from the old site. Your idea is correct and you will simply replace the newly created folders with the older folders. Import the SQL data. You undoubtedly will have some variances which you cannot fix before you copy but I would guess they should be minimal.
Avatar of David Favor
Yes. Just copy all your files to their new home + load your database into MariaDB or MySQL, which ever is running.

The only minor gotcha. If you create the zip file yourself, be sure to use the --symlinks option, else some caching + monitoring plugins may break. is also a great option, especially if you migrate + change domain names, like moving a dev/staging site to a production site.
Avatar of Tessando


Thanks Guys - I was able to get this working based on both suggestions: To bottom-line it, I did an "air lift" the best I could. I ended up importing the SQL User and MySQL Database with the same password and username based off the wp-config file.

Now, that said, there is a goofy 301 redirect plug-in so, unless there is another way to test, I'd have to swap the DNS, wait for the propagation and test using the domain name.

I'm going to leave this open today, as I'll start working on this in the next couple hours. Thanks again for your help.
In your original question you stated...

This site is going to use the same domain name, but on a different server.

If you've changed the domain, then the process of just moving the database will fail.

If old domain + new domain name differ, than you must use a backup/restore process like Duplicator or BackupBuddy or similar provide.

Part of the restoration process for this type of plugin is rewriting all the database serialized data which contains embedded site URLs.

If your domain name changed + you miss the complete database rewrite step... trouble will ensue...

You can also do this manually on the command line (my preferred method), using wp-cli via something like this...

wp search-replace "" "" --precise --recurse-objects --all-tables --dry-run

Open in new window

Using dry-run will tell you how many links will be changed.

Remove --dry-run to actually have command commit changes.

If you go this route, be sure you change all the www + bare domain + http, so you end up with as your only site wide link.

Or whatever your site wide link might be.
Thank you, David. I am not going to change the domain name.
If the domain name remained the same, then a simple migration (with now database rewrites) should be sufficient.

Just change the IP + you should be good.
Thank you, David. Yes, I hit a road-block with the .htaccess file, but I was able to turn that breakdown into a break-thru: Once I modified Apache's httpd.conf file (/etc/httpd/conf/httpd.conf) I was able to get in. Changing the "AllowOverride" feature lets me now login to the Dashboard and see various pages.

However, changing hosts has opened up some permission challenges (not suprisingly).

The first one is to update Wordpress. When I click on the link from the dashboard I get the following:

Downloading update from…

Unpacking the update…

Could not create directory.

Installation Failed

Open in new window

This leads me to my other question: What permissions do I need to set/assign in order to get Wordpress and Plugins to update?

Thanks again for your help.
Per the best practices that Wordpress recommends, Folders are set to 755 and Files set to 644. I am logged into the server now and have verified that this is the case.

I am wondering if this has to go with Folder and File permissions in order to write to a given folder. I setup this LAMP stack per Amazon's instructions and (in doing so) have the User ec2-user and the Group Apache.

I purposely changed these from "root root" to "ec2-user" "apache".

Because this was an "airlift" do I need to reset those permissions in order for them to become effective? I attempted using the following and still can't get Wordpress or Plugins to update.

sudo find /var/www/html/ -type d -exec chmod 755 {} \;
sudo find /var/www/html/ -type f -exec chmod 644 {} \;

Open in new window

User generated image
Man, I'm pretty stumped here. Is there another place to check for permissions? My User in Wordpress has "Administrator" permissions.
Avatar of Tessando
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Airlifting WP can be difficult for those of not super familiar with Wordpress.  All the solutions and contributions in this post were very helpful. Ultimately, making sure permissions are set properly and that the way Apache reWrite is being used are two common issues.