WordPress migration tips

I was working tonight on what should have been a straightforward WordPress migration from my staging site to my client’s live site. It should have taken less than an hour but took me 8 hours instead!!  From 6-1am on a snowy Saturday. I literally just finished it, and here are some tips that I am going to share before I crash for the night. 

Problem 1: Installed WordPress from within the web host control panel. Links and things did not work. That took a couple hours to debug.

Tip 1: I did not realize that web hosts bundle the WordPress install with junk and themes and plugins that are NOT part of a fresh WordPress install.  That messed up the site because of these junk plugins.  Always install WordPress as a fresh download from wordpress.org, and do NOT use the web host’s application to install WordPress.  Yeah, it takes longer, but you’re ensured that it’s truly a clean install and not bundled with junk.  Now make sure you can obtain the database username and password. For some reason, this web host that I was using did not supply that, but I was able to get it from the wp-config.php when I opted for the control panel install.  I copied that down, then deleted the whole thing and started with a fresh, manual install.

Problem 2: Ok, WordPress system is finally working. Next, I tried to activate the new theme (Envato’s Enfold theme), and I got an HTTP 500 error.  The default themes did not produce such errors.  Ugh.  I tried soooooooooo many different things, but I could have saved myself 3 hours of work if I had just done this:

Tip 2: Edit wp-config.php and set DEBUG to TRUE.  
define(‘WP_DEBUG’, true);
This will right away produce error messages that you can Google to figure out what the problem is. I had a PHP memory overload issue.

Problem 3: Now I need to increase PHP memory limit.  Contrary to everything I read online, NOTHING WORKED.  Editing wp-config.php to add define(‘WP_MEMORY_LIMIT’, ‘256M’);  did not have any effect.  Editing .htaccess to add add php_value memory_limit 256M only produced internal server errors. 

Tip 3: To solve PHP memory overload issue, create a php.ini file in both WordPress root folder AND wp-admin folder. This was the only thing that worked for me. Here is the code that I used:

upload_max_filesize = 1000M
post_max_size = 2000M
memory_limit = 3000M
file_uploads = On
max_execution_time = 180

That only took about 2 hours to figure out, but thankfully Google helped me out on that one. The theme was finally able to be activated!!  I rewarded myself with a bite of chocolate and continued onward.

Bonus tip: Use Live Preview to see if it activates the theme.  This is an easy way to identify problems without having to actually activate the theme, be faced with an HTTP 500 error, and then have to rename the theme folder, or go into PHPMyAdmin and manually tell WordPress to use a different theme.

Problem 4: Alright, now that WordPress is functioning and the theme is finally activated, time to import the content using the built-in WordPress Importer tool.  Of course, this crashed multiple times.  WordPress kept timing out because the content was so large.

Tip 4: Upload your content in batches.  So export the posts and upload. Then export the pages and upload. Export the media and upload. This is a much easier process.  Media might take a few tries to get it uploaded, but it won’t duplicate your images, so just keep re-uploading the file until you finally get the “all done, have fun” message.  Also, with this method, you do not have to actually upload the Uploads folder into wp-content folder, as the WP Importer will do it all for you and display them in the Media library.

Problem 5: Alright, now WordPress is up, theme is activated, content is live, and I am faced with hundreds of links pointing to my old site.  So I figure I’ll download a plug-in and get them all changed to the new URL to avoid database serialization problems.  Problem is, the plug-ins out there don’t work. I tried Velvet Blues first. That only changed like 2 things.  Then I tried Search and Replace. When I went to activate it, I got a fatal error. 

Tip 5: The only plug-in that worked for me is Better Search and Replace. You can even do a dry run first. It’s free, and it worked, simple as that.  Remember to back-up your database first!!!

Final Tip: If possible, and client-willing, use a web host that actually works with WordPress from the get-go.  I highly recommend Site5. I’ve been with them since 2006. Everything just works…I have never encountered any of the issues above.  I’ve installed WordPress from the control panel and it works and does not have any of the junk added in. I was able to add Envato’s themes with no problem. I’ve never encountered any PHP memory limits with them.  I’m on the HostPro+Turbo package.

I did have an issue a while back where I tried to migrate to a VPS server and it was a HORRIBLE experience. I ended up canceling that whole thing, but not without a lot of down time, stress, and feeling terrible for my poor clients.  If you just start out fresh on a VPS server, you’d probably be okay though.  Their email server is also horrible and gets black-listed by many email providers and is filled with spam, even though I am supposedly on a “dedicated IP.”  It’s all still shared hosting in my opinion.  So get Google Apps for your email.  If my clients want email, that’s what I put them on. Otherwise, the in-house email from the control panel is spammy and terrible.

But to use Site5 just as a good ol’ fashioned web host, they are the best! All my client sites are hosted with Site5, except for one. That one is hosted on BlueHost, and they are another terrible provider. Their email server is also black-listed, and their customer support is bad. Stay away.

Basic Windows command line prompts

You can access the Command Prompt by clicking the Start menu and entering “cmd” into the search field. You can also access it by entering “cmd” into the Run field, or it can be found in the Accessories/System Tools folder of the Start menu.

  • cd <folder> – This command will move you to the folder that you specify. The folder must be in the directory you are currently in. For example: If you are currently at “C:\Users\<username>\” and you enter cd desktop you will be taken to “C:\Users\<username>\Desktop\”
  • cd <path> – This command will take you to a specific path on your computer. You do not need to be in the same directory as the path. You must enter the entire path for it to work. For example: cd C:\Windows\System32
  • cd .. – This command will move you up one directory from your current location. For example: If you are currently at “C:\Users\<username>\” and you enter cd .. you will be taken to “C:\Users\”
  • cd\ – This command will take you to the root directory, regardless of your location. For example: If you are currently at “C:\Users\<username>\” and you enter cd\ you will be taken to “C:\”
  • <driveletter>: – This command will take you to the drive letter that you specify. The drive you specify will need to be active, or have a disc in it if it a CD\DVD drive. For example, if you want to switch to your D drive, you would enter the command D:
  • exit – This command will exit the Command Prompt, no matter your current location.
  • ren *.* *.jpg – . will select all files, and rename to * (what ever name they have) plus extension to jpg

Printers not showing up in Windows 8

Solution: Clear Printer Spooler Files and Enable the Spooler Service
1. Run “Services.msc” (without the quotation marks).
2. Double-click “Printer Spooler” in the Services list.
3. Click Start if not running.  Check Printer list to see if devices appear.  If not, continue:

If running, Click Stop and click OK.
4. Navigate to “%WINDIR%\system32\spool\printers”, delete all files in this folder.
5. Run “Services.msc” (without the quotation marks).
6. Double-click “Printer Spooler” in the Services list.
7. Click on Start. In the Startup Type list, make sure that “Automatic” is selected and click OK.