View Full Version : Updated to 1.8.0 - unable to connect to database

01-21-2004, 06:33 AM
It say's - check the configuration script.

in \admin\index.php is:

Header('Pragma: no-cache');
$relative_script_path = '..';
include "$relative_script_path/includes/config.php";
include "$relative_script_path/libs/auth.php";

The instructions for relative script path say:-
The $relative_script_path must contain the relative path of PhpDig's root directory from the current script.

so the path is .. [the directory below \admin].

Have I understood it so far!

In \includes\config.php we have the additional lines of:

if ((isset($relative_script_path)) && ($relative_script_path != ".") && ($relative_script_path != "..")) {
if (eregi("config.php",$_SERVER['SCRIPT_FILENAME']) || eregi("config.php",$_SERVER['REQUEST_URI'])) {

Surely this is saying that if the relative_script_path is .. then exit with error message.

Perhaps I definately do not understand that!

So PhpDig is now dead unless You can help - otherwise the only way to get things working is to go back to the previous version.

p.s. The Database connection information has been entered correctly and double checked.


01-21-2004, 09:25 AM
Hi. PhpDig version 1.8.0 already has the following code in the config file:

if ((isset($relative_script_path)) && ($relative_script_path != ".") && ($relative_script_path != "..")) {
if (eregi("config.php",$_SERVER['SCRIPT_FILENAME']) || eregi("config.php",$_SERVER['REQUEST_URI'])) {

The code that gives the "Unable to connect to database : Check the connection script" errror is the following:

// Connection configuration

//connection to the MySql server
$id_connect = @mysql_connect(PHPDIG_DB_HOST,PHPDIG_DB_USER,PHPDIG_DB_PASS);
if (!$id_connect) {
die("Unable to connect to database : Check the connection script.\n");

Try calling the PhpDig version 1.8.0 connect.php file from the browser. If it throws the "Unable to connect to database : Check the connection script" error, then that means that the database variables are not properly configured.

01-22-2004, 03:39 AM
Hi Charter

Please accept my apologies for bothering you with a problem which was due entirely to my brain not functioning correctly.

I would never have thought of calling the connect.php direct from the browser, it confirmed that the database variables were not set correctly.

To clarify, they were set correctly but when I entered the data I did not remove the '<' and '>'. What an idiot!

My best regards to you and sorry to hear about the troubles.
Is there anything I can do to help.