I recently moved a website with a MYSQL database to a new server. The problem is the old server was using a sub.domain name and the config file still points to the sub.domain. I've tried many approaches, but can't get the database to connect.
I believe the issue is that the database is still trying to use the sub.domain name. instead of the new domain on the new server. I tried removing references to: WHERE subdomain=, but i still can't connect to the database.
any help would be appreciated. Config file info below.
<?php
// Database settings
$database = array();
$database['host'] = "localhost";
$database['user'] = "***********";
$database['password'] = "***********";
$database['database'] = "***********";
#echo "<h1>".$_SERVER['SERVER_NAME']."</h1>";die();
define('SITE_MAIN', 'dessinsllcportal.com');
if (!(mysql_connect($database['host'], $database['user'], $database['password'])))
crash_q();
if (!(mysql_select_db($database['database'])))
crash_q();
mysql_query("SET NAMES 'utf8'");
$ref = explode('.', $_SERVER['SERVER_NAME']);
$query = "SELECT * FROM sites WHERE subdomain='".$ref[0]."'";
if (($result = mysql_query($query)))
{
$dbRow = mysql_fetch_assoc($result);
define('FM_HOST', $dbRow['host']);
define('FM_FILE', $dbRow['file']);
define('SITE_URL', 'http://'.$dbRow['subdomain'].SITE_MAIN);
}else{
define('FM_HOST', '');
define('FM_FILE', '');
define('SITE_URL', 'http://'.$dbRow['subdomain'].SITE_MAIN);
}
define('FM_USER', 'PHPuser');
define('FM_PASS', 'inter10r');
define('USER_LAYOUT', 'PHP_User');
define('SMARTY_DIR', '/var/www/clients/client120/web138/web/smarty/');
define('APP_FULL_PATH', '/var/www/clients/client120/web138/web');