Hi Dave,
How do you put the database on one URL and server, while the web site is on another? Can this be done from config.php?
Cheers
Mark
Hello. Thanks.
We have tried the above, and we are getting the following errors:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/server5/public_html/partnersite-cheapest-bargain.com/includes/database.php on line 17
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/server5/public_html/partnersite-cheapest-bargain.com/includes/database.php on line 21
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/server5/public_html/partnersite-cheapest-bargain.com/includes/database.php on line 26
Here is what our config file says (I've taken out the password):
<?php
ini_set('memory_limit','128M');
set_time_limit(36000);
$config_title = "Cheapest Bargain [Remote Mode]";
$config_charset = "utf-8";
$config_baseHREF = "/";
$config_useRewrite = TRUE;
$config_useRelated = true;
$config_useTracking = true;
$config_useJavaScript = false;
$config_useInteraction = true;
$config_currencyHTML = "£";
$config_resultsPerPage = 10;
$config_databaseServer = "cheapest_cbcouk.cheapest-bargain.org.uk";
$config_databaseUsername = "cheapest_cbcouk";
$config_databasePassword = "XXXXXXXXXXXX";
$config_databaseName = "cheapest_cbcouk";
$config_databaseTablePrefix = "";
?>
Can you see what the problem is?
Thanks,
Mark.
Hi Mark,
With the new database settings in place, browse to setup.php - this will show you the result of testing each stage of the database connection (connection, authentication, SQL).
If this displays:
Checking database connection...FAIL
Then if you're sure that username and password are correct; the most likely cause is that the server at cheapest_cbcouk.cheapest-bargain.org.uk is not listening on the MySQL port (3306). Alternatively, if the server itself is listening, there could be firewall restrictions in place - check with your host if that is likely to be the case and they should be able to add an exception so that you are permitted to make this connection...
Cheers,
David.
Hi Mark,
PHP needs to access the database natively, but the database can still be on a different server - and in my shared hosting environments it often is. Typically, where MySQL is on the same server you would have in config.php:
$config_databaseServer = "localhost";
...and when it's on a remote computer, something like:
$config_databaseServer = "mysql1234.example.com";
So that would be all you need to do, but bear in mind that any firewalls etc. would have to be configured to allow inbound access to the remote server on the default MySQL port (3306), and also MySQL would have to be configured to listen on that port also instead of only accepting local connections...
Cheers,
David.