Modifying WP-config’s PHP to detect server and use appropriate database
-
Hello,
I am using wordpress with SVN and I want to find a way to modify the WP-config file so that it works both locally and remotely through an IF statement. Basically I want to use the PHP to detect which server it is running on and then use the appropriate database.
I am not very familiar with PHP but have heard that if you modify the wp-config file to include:
if($_SERVER['HTTP_HOST'] == 'example.com'){ // PRODUCTION $conf['db_hostname'] = "xxx"; $conf['db_username'] = "xxx"; $conf['db_password'] = "xxx"; $conf['db_name'] = "xxx"; } else { // DEV OR WHATEVER $conf['db_hostname'] = "xxx"; $conf['db_username'] = "xxx"; $conf['db_password'] = "xxx"; $conf['db_name'] = "xxx"; }
But I am not really certain how to implement this code. Any thoughts?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Modifying WP-config’s PHP to detect server and use appropriate database’ is closed to new replies.