I have mysql connection errors when previewing my outersite, why ?
There are mainly two reasons for this:
- You did not provide the right MySQL login/password in step 2 of the Database tabsheet. Remember that these are the login and password used by your PHP code to connect to the database.
- Your PHP code uses a host different from "localhost". This happens if your online website uses 2 servers (one for apache, and another for mysql).
The first case is easy to solve. Double check that you provided the right login and password. If you are not sure of what these login and password are, please read below.
The second case is not difficult to solve but requires that to you manually correct the PHP files:
- On the "Files" tabsheet, use the "Open copied files directory..." button to locate your PHP files
- Use an advanced text editor to search through your php files for the string "mysql_connect"
- You will probably find PHP code that look like this:
$server = "123.234.123.234";
$login = "mylogin";
$pswd = "mypasswd";
$bdd = "mydatabasename";
$connect = @mysql_connect($server,$login,$pswd)or die ('error while connecting to the DB');
@mysql_select_db($bdd, $connect)or die ('error while connecting to the DB');
- Replace the string "123.234.123.234" (or whatever it is in your case) by "localhost", and there it is!
- And note that you can also read here the login and password to be provided in step 2 of the Database tabsheet...
Download OutSite-In 30-day free trial!
