tags:

views:

16

answers:

1

I am making some updates to a php site which I did not design. I have a local copy of the site. At the top of each page there are settings for the host name for the db connection.

Is there someway I can setup a pointer to the remote address. The address is 'mysqlhost' for example and I want that to point to 'mysql.myhost.com'. I tried creating a HOST record for mysqlhost pointing to the IP address it resolves to but that doesn't work.

If I put 'mysql.myhost.com' in the connection it works. If I put that IP address it doesn't so that is probably why the HOST record idea doesn't work.

Other than creating a local copy of the DB is there a quick way so that I don't have to modify each file in my dev environment and then again when I redeploy?

A: 

It will probably be more maintainable if you do a global search and replace with your favorite text editor.

While you're doing that, put the connection info in a .inc file and change the current host info to a line that just includes the one .inc file.

Once you have done that, you can just change the .inc file (or have conditional logic in the .inc file to indicate DEV vs. PROD), so there's just one place to update when moving between environments.

Eric J.