Avatar of Tessando
Tessando
Flag 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.
LinuxAWSWordPress

Avatar of undefined
Last Comment
Tessando

8/22/2022 - Mon
Gregory Miller

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.
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.

https://wordpress.org/plugins/duplicator/ is also a great option, especially if you migrate + change domain names, like moving a dev/staging site to a production site.
Tessando

ASKER
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.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
David Favor

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 "https://oldfoo.com" "https://newfood.com" --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 https://newfoo.com as your only site wide link.

Or whatever your site wide link might be.
Tessando

ASKER
Thank you, David. I am not going to change the domain name.
David Favor

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.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Tessando

ASKER
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 https://downloads.wordpress.org/release/wordpress-4.9-no-content.zip…

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.
Tessando

ASKER
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


perms.png
Man, I'm pretty stumped here. Is there another place to check for permissions? My User in Wordpress has "Administrator" permissions.
ASKER CERTIFIED SOLUTION
Tessando

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Tessando

ASKER
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.
Your help has saved me hundreds of hours of internet surfing.
fblack61