Cannot connect to database

I installed WackoWiki successfully on my server at home without any problems. However, when I installed on a remote host provider, it fails due to database connection error message. I know all of the setting are correct. One thing that I noticed is that the URL always had a // inserted after my domain name. Could that be an issue?

Comments

  1. Please turn PHP error reporting on

    I assume the wiki engine reports to you "Cannot connect to database", right?

    Did the installer throws this error message?

    Please turn the PHP error reporting on: config/constants.php

    define('PHP_ERROR_REPORTING',			5);


    Now PHP should provides you an additional error message.

    Check if the chosen database_driver is available on your server. [mysqli/mysql_pdo]
    Did you chose the correct port for the driver?

  2. What is the port #?

    Here is the error message that I received during the installation. "There was a problem with the database connection details you specified, please go back and check they are correct." I did confirm that the host name, DB name, username, and password are all correct. I also verified with the hosting company that the mysqli driver is supported. Correct port? Is that different from the default 3306? That could be my problem if it is not.

    • Guest
  3. DB port

    The DB port might differ from the default port even per database driver.

    Did you already check it with error reporting on? Please test both drivers (mysqli and PDO).

  4. DB Port 3306

    I verified with the host provider and they confirmed port 3306. I also enabled PHP Error Reporting as you described. Here is the error message that I received in the error log file.

    PHP Notice: Array to string conversion in /htdocs/setup/header.php on line 64

  5. the initial database connection test fails

    PDO

    $dsn = "mysql:host=".$config['database_host'].($config['database_port'] != '' ? ";port=".$config['database_port'] : '').";dbname=".$config['database_database'].($config['database_charset'] != '' ? ";charset=".$config['database_charset'] : '');
    
    // [..]
    
    // Do the initial database connection test seperately as it is a special case.
    try
    {
    	test($lang['TestConnectionString'], $dblink = @new PDO($dsn, $config['database_user'], $config['database_password']), $lang['ErrorDBConnection']);
    	$dblink->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }
    catch(PDOException $e)
    {
    	test($lang['TestConnectionString'], false, "PDO Error: ".$e->getMessage());
    	$fatal_error = true;
    }


    mysqli
    if(!test($lang['TestConnectionString'], $dblink = @mysqli_connect($config['database_host'], $config['database_user'], $config['database_password'], null, $port), $lang['ErrorDBConnection']))
    		{
    			/*
    			 There was a problem with the connection string
    			 */
    
    			echo "         </ul>\n";
    			echo "         <br />\n";
    
    			$fatal_error = true;
    		}


    at least the PDO driver should give you some hints (?)

    • WikiAdmin
    • edited
  6. WW 5.1 Installation Works

    I set the default version of PHP to 5.3 and installed WackoWiki version 5.1 and it installed without any issues using the same DB host, DB name, username, and password. I am not sure why PHP 5.5 and WackoWiki 5.4 did not install.