Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 06:10:14 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155547 Posts in 21714 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Edit config.php for Server Migration  (Read 782 times)
jtrein

Offline Offline

Posts: 24


« on: June 01, 2011, 03:10:44 PM »

Hello,

If my server A has a directory of /main/[ALL WEBSITE BAKER FILES] and I want to install [ALL WEBSITE BAKER FILES] on the root folder of server B, do I need to change my config.php file to reflect the right folder paths?

Below is a current copy of server A:

Code:
<?php

define
('DB_TYPE''mysql');
define('DB_HOST''localhost');
define('DB_USERNAME''example');
define('DB_PASSWORD''example');
define('DB_NAME''example');
define('TABLE_PREFIX''');

define('WB_PATH'dirname(__FILE__));
define('WB_URL''http://localhost/main');
define('ADMIN_PATH'WB_PATH.'/admin');
define('ADMIN_URL''http://localhost/main/admin');

require_once(
WB_PATH.'/framework/initialize.php');

?>

Should I do the following for server B? :

Code:
<?php

define
('DB_TYPE''mysql');
define('DB_HOST''localhost');
define('DB_USERNAME''example');
define('DB_PASSWORD''example');
define('DB_NAME''example');
define('TABLE_PREFIX''');

define('WB_PATH'dirname(__FILE__));
define('WB_URL''http://somesite.com'); // removed 'main' & added domain name
define('ADMIN_PATH'WB_PATH.'/admin');
define('ADMIN_URL''http://somesite.com/admin');  // removed 'main' & added domain name

require_once(WB_PATH.'/framework/initialize.php');

?>
« Last Edit: June 09, 2011, 06:16:28 PM by jtrein » Logged
YoJoe

Offline Offline

Posts: 74


WWW
« Reply #1 on: June 01, 2011, 03:59:02 PM »

I hope you didn't forget to change also the domains for WB_URL and ADMIN_URL variables in config file ?
Otherwise when you enter yourdomain.tld, WB will load all data from your local lamp server Wink
Logged

WuJitsu - in web I trust  cool
jtrein

Offline Offline

Posts: 24


« Reply #2 on: June 01, 2011, 05:53:17 PM »

@YoJoe

Right on, brother and thank you.  So, do I have the right idea here?  Is this what I need to be doing?
Logged
YoJoe

Offline Offline

Posts: 74


WWW
« Reply #3 on: June 01, 2011, 07:17:19 PM »

Hmm...is this your first migration attempt ?

You will need to provide also:
- database and username
- if dbase isn't hosted on the same machine ip/hostname of database machine (db_host)
- look if .htaccess file contains:
RewriteBase /main/   (leave only / )
any redirect or rewrite rules pointing to /main/ directory

If you forget to change some crucial info, turn on error reporting before you upload database to new location, and see if any errors in regard of paths to files appears.
Just a simple approach to debug any problems after migrating to new location Wink
Logged

WuJitsu - in web I trust  cool
jtrein

Offline Offline

Posts: 24


« Reply #4 on: June 01, 2011, 07:40:21 PM »

@YoJoe

It sure is!  I'll make sure to get the database & username and insert those.

  • I checked my .htaccess file and it doesn't contain anything to that effect - so I'm good there.
  • I just turned on error reporting at level 'All'.

Also, I had better backup the config.php file.  Am I on the right track?


Kindest and thanks!,

jtrein
Logged
YoJoe

Offline Offline

Posts: 74


WWW
« Reply #5 on: June 01, 2011, 08:13:15 PM »

Just do it man !  afro
If something bad happens, you still have files & dbase on your A location Smiley
Logged

WuJitsu - in web I trust  cool
jtrein

Offline Offline

Posts: 24


« Reply #6 on: June 01, 2011, 08:22:27 PM »

I like it.  I will do that.  I'll be back on here to give a thumbs up, or down!  grin
Logged
jtrein

Offline Offline

Posts: 24


« Reply #7 on: June 07, 2011, 12:48:58 PM »

@ YoJoe

Thanks, brother!  All is well!

I essentially followed your advice, and my original train of thought wasn't far off (which is odd).

Also, I trusted that I wasn't a special case and followed this Help article to a 'T': http://www.websitebaker2.org/topics/moving-from-server-a-to-b.php (thanks, Website Baker).


Kindest,

jtrein
Logged
gordon_fern

Offline Offline

Posts: 7


« Reply #8 on: June 07, 2011, 02:14:29 PM »

Another Gotcha to be aware of is that very often the content saved in the database contains absolute paths to graphics etc.  Perhaps the easiest way to fix it is going  to be to edit the mysql dump file before uploading to the new file server and replace such paths.

eg.  search and replace http://old_server/some_path/ to http://new_server/

If your mysql dump file isn't too huge for your text editors. Otherwise you'll have to update with SQL but that will be more fraught.

eg.

update <prefix>mod_wysiwyg
  set content =replace(content,'http://old_server/some_path/','http://new_server/'),
        text=replace(text,'http://old_server/some_path/','http://new_server/');

for starters and then depending on what other modules your site uses there may well be other tables as well.
Logged
jtrein

Offline Offline

Posts: 24


« Reply #9 on: June 07, 2011, 03:16:44 PM »

@ gordon_fern

Thanks!  That's awesome, I didn't know you could do that.
Logged
Bramus
Forum Team
*****
Offline Offline

Posts: 601


WWW
« Reply #10 on: June 17, 2011, 09:19:59 PM »

jtrein dont forget to test all modules (like adding news and deleting items). It could be the chmodding if it isnt working. So make sure to test it, else chmod the folder AND all files smiley
Logged

BRAMUS Internet Services
jtrein

Offline Offline

Posts: 24


« Reply #11 on: July 30, 2011, 08:44:01 PM »

Thank you!
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!