Migrating a Wordpress installation from your localhost to a production server (using cpanel)
Say you have locally WP installed under WAMP or MAMP or whatever under;
http//localhost:8888/somesite
and you want to run it, with all content and plugins and what have not under:
http://www.somesite.com
The steps to do this:
- create somesite.com in your WHM system (http://yourhost.com/whm) or make sure your site exists
- go to your local phpmyadmin, usually; http://localhost:8888/ and then clicking on phpmyadmin
- click on the database you are using
- click on export
- make sure SQL is selecting on the left
- click on go
- open another tab in your browser and open http://www.somesite.com/cpanel
- login
- create a database and a user for that database and remember what you you used there
- now open phpmyadmin in your cpanel
- click on the database you just created
- click on SQL
- copy/paste the sql from your localhost tab into this new db and click go
- now connect (with ftp) to your somesite.com server and copy over everything in your root directory from your localhost (for instance; htdocs/somesite/*)
- edit, remotely, your public_html/wp-config.php; change the values DB_NAME, DB_USER, DB_PASS to the values you used to create your db in cpanel
- now, basically, your site should work; simply try http://www.somesite.com
- if you get a database error, please check your remote wp-config.php to see what went wrong
- you probably now get some error; not found http://somesite.com:8888 or something like that; this is because the php options are wrong
- to fix this, just open SSH to your remote server and run;
cd /home/somesite
mysqldump YOURDBNAME wp_options > tmp.sql
sed -i 's/localhost:8888\/somesite/www.somesite.com/ig' tmp.sql
mysql YOURDBNAME < tmp.sql
Now your site will work.
Have fun.
