Sanjeev Sabhlok's notes on technology, hardware, gardening

Troubleshooting the transfer of website/ blog/ blogs from Downtownhost to Dreamhost

KEYWORDS: TROUBLESHOOT TRANSFER WORDPRESS BLOG TO DIFFERENT WEB HOSTING COMPANY LARGE DATABASE. MULTIPLE DOMAINS.

Dreamhost is better than Godaddy in that it allows unlimited shell access. But it is way more complex than Downtownhost since it doesn't use cpanel.

IN DOWNTOWNHOST


 

 

 

1) CREATE A MYSQL DUMP FOR EACH DATABASE USING THE FOLLOWING SCRIPT

===

#!/bin/bash

for i in [DIRECTORY CONTAINING WP FILES 1, e.g. sanjeev] [DIRECTORY 2, ETC] ; do
   cd "$i"
   read db un pw < <(awk -F", *'|');" '/(DB_USER|DB_NAME|DB_PASSWORD)/{print $2}' ORS=' ' wp-config.php)

   mysqldump -h localhost -u "$un" -p "$db" –no-autocommit –add-drop-table –add-locks –password="$pw" > wp-content/dbdump.sql

   cd –
done
===
This will drop the dbdump file in each of the /wp-content directories.

2) Databases too large

Almost no database was less than 7MB, the limit for sql files on Dreamhost. That meant using the UNIX shell.
3) AVOID ZIP OPTION

My disk usage in Downtownhost was close to 10 GB (limit) so creating zip files is stricly no! no! ONLY FTP (in this case wget through UNIX) is the sensible option.

2) IN GODADDY (FROM WHICH WHERE DOMAINS HAVE BEEN PURCHASED)

Point DNS to Dreamhost

1) change DNS servers in godaddy from downtownhost to dreamhost

2) create a new domain in dreamhost
– WAIT
3) update IP address in DNS zone (enter the IP address of my domain's ANAME). You can control IP address (through DNS zone) only for domains hosted on goddady. For other domains you can’t do it. you can do NOTHING but wait if it is hosted elsewhere. Takes 4-48 hours to resolve! That’s really bad.

DNS PROBLEM WITH SABHLOKCITY (others didn't have it since I selected the correct option)

I had a problem because I selected an incorrect option in dreamhost while setting up sabhlokcity. I had an issue with too many redirects. 

a) HTACCESS ENTRY problem: http://www.wpwhitesecurity.com/wordpress-tutorial/fix-too-many-redirects-error-wordpress/.  After this the chrome redirect issue got fixed.

b) Fix in the SQL database

UPDATE wp_posts SET post_content = REPLACE (  

post_content,  
'sabhlokcity.com', 
'www.sabhlokcity.com')

THEN:
UPDATE wp_posts SET post_content = REPLACE (  
post_content,  
'www.sabhlokcity.com', 
'sabhlokcity.com')

==

IN DREAMHOST

1) CREATE DNS AND NEW DATBASE FOR EACH WEBSITE (DATABASE NAME SHOULD BE THE SAME AS THE OLD ONE)

MAKE SURE THAT EACH DATABASE YOU CREATE HAS ACCESS FOR [MAINUSER-you know which!] user since otherwise you can’t access through phpmyadmin.

Do you have to create a new directory if you add a domain/sub-domain? No, you do not. A new directory will automatically appear (in the name of your domain) in your users directory within fifteen minutes of adding the domain. You don't need to create a new directory yourself.

2) DOWNLOAD ENTIRE OLD WEBSITE WITHOUT MISSING A SINGLE FILE INTO A SEPARTE FOLDER:
a) THIS CAN TAKE A LONG TIME SO MAKE SURE YOU USE SCREEN LEST YOU GET DISCONNECTED
http://www.thegeekstuff.com/2010/07/screen-command-examples/#more-4476

type screen
issue the command
type  CTRL+A followed by d to detach the screen.
Once it is over 
type “screen -ls”
this will give the name of the screen processes
when ready, attach it back:
screen -r “NAME OF SCREEN PROCSSS”

b) command is:
wget -r –level=10 ftp://[username][password]@[ftp host]
help from here: http://www.cyberciti.biz/faq/wget-recursive-download-command/

NOTE THAT WGET HAS A DEFAULT OF 5 LEVELS SO YOU NEED THE LEVEL OPTION
       –level=depth
       Specify recursion maximum depth level depth. The default maximum depth is 5.

This can take over 2 hours for 10GB.

HOW DID I DISCOVER THE NEED FOR THE "LEVEL" OPTION? I got a BLANK screen in one of my blogs after transfer.

Upon checking “inspect element” I found this:

<html>

   <head></head>

   <body style=></body>

</html>

I discovered that the relevant THEME had not been ported. This indicated that files had not been properly ported from the older domain. By porting the entire files again – using the "level" option, this was fixed.

3) RECURSIVELY COPY FILES TO THE RELEVANT NEW DIRECTORY (E.G. TO SANJEEV.SABHLOKCITY.COM)

Files in bulk are copied in a separate folder, so go to just above the place where the files are stored then

cp -R . ~/sanjeev.sabhlokcity.com

4) NOW GO TO RELEVANT WP-CONTENT DIRECTORY AND RESTORE MYSQL DATABASE

>mysql -h [MYSQL HOST] -u [MAINUSER] -p [DATABASE NAME] –password=[PASSWORD] < dbdump.sql

5) MAKE SURE WP-CONFIG.PHP IS CHANGED APPROPRIATELY.

You MUST use [MAINUSER] as username! 

And change the password for the database, and replace localhost with the path to the mysql server.

In the case of freedomparty.in the new path is freedomparty.sabhlokcity.com, and every hardcoded reference has to be changed. I had used phpmyadmin to download and upload the database. It required the following command:

UPDATE wp_posts SET post_content = REPLACE (  
post_content,  
'freedomparty.in/',  
'freedomparty.sabhlokcity.com/'); 

That didn't work. Do the following.

6) FIX DATABASE

a) CHANGE THE UPLOAD PATH IN ALL BLOGS BY GOING INTO THE WP_OPTIONS TABLE ITEM 60

I had to do a NUMBER OF replacements manually in this table (not just item 60) for freedomparty.in to freedomparty.sabhlokcity.com. Then wp-admin/ login came back online. ALSO HAD TO DISABLE PLUGINS DIRECTORY. FIXED IT LATER.

b) REPLACE THE FOLLOWING WITH EMPTY SPACE IN THE ENTIRE DATABASE

style="
-size: 12px;"

SQL COMMAND
UPDATE wp_posts SET post_content = REPLACE (  
post_content,  
'style="
-size: 12px;"',  
' ');  

Print Friendly, PDF & Email

sabhlok

View more posts from this author

Leave a Reply

Your email address will not be published. Required fields are marked *