Could not create database connection (3.18)

I am getting the following error:

    $ php install/step_02.php /home/kdtest3/mysource_matrix
    
    Fatal error: Uncaught exception 'Exception' with message 'Could not create database connection: DBError!:could not find driver' in /home/kdtest3/mysource_matrix/core/include/mysource.inc:2216
    Stack trace:
    #0 /home/kdtest3/mysource_matrix/core/include/mysource.inc(211): MySource->changeDatabaseConnection('db')
    #1 /home/kdtest3/mysource_matrix/core/include/init.inc(233): MySource->init()
    #2 /home/kdtest3/mysource_matrix/install/step_02.php(57): require_once('/home/kdtest3/m...')
    #3 {main}
      thrown in /home/kdtest3/mysource_matrix/core/include/mysource.inc on line 2216


Please could you advise on what I need to do to get past this error?

OK,


I fixed this error by installing all the PEAR packages and PECL packages required (via WHM on my server): http://matrix.squiz.net/resources/requirements is where you can find out the packages required.



Unfortunately I’m now getting a new error:


    $ php install/step_02.php /home/kdtest3/mysource_matrix
    php: symbol lookup error: /usr/local/lib/php/extensions/no-debug-non-zts-20060613/pdo_pgsql.so: undefined symbol: php_pdo_declare_long_constant

What OS and PHP version are you running?

while we are waiting for scott to answer :slight_smile:


im stuck on step 2 as well (3.18.1) but getting "Fatal error: Uncaught exception 'Exception' with message 'Could not create database connection: DBError!:SQLSTATE[08006] [7] could not translate host name "db" to address: Name or service not known"



followed instructions as much as possible although i think this is wrong? shouldn't "developers" be "matrix" in the example?



$db_conf = array (

'db' => array (

'DSN' => 'pgsql:dbname=matrix;host=db',

'user' => 'developers',

'password' => '',

'type' => 'pgsql',

),

'db2' => array (

'DSN' => 'pgsql:dbname=matrix;host=db',

'user' => 'developers',

'password' => '',

'type' => 'pgsql',

),

'db3' => array (

'DSN' => 'pgsql:dbname=matrix;host=db',

'user' => 'developers_secondary',

'password' => '',

'type' => 'pgsql',

),

'dbcache' => NULL,

);



return $db_conf;

[quote]while we are waiting for scott to answer :slight_smile:


im stuck on step 2 as well (3.18.1) but getting "Fatal error: Uncaught exception 'Exception' with message 'Could not create database connection: DBError!:SQLSTATE[08006] [7] could not translate host name "db" to address: Name or service not known"



followed instructions as much as possible although i think this is wrong? shouldn't "developers" be "matrix" in the example?



$db_conf = array (

'db' => array (

'DSN' => 'pgsql:dbname=matrix;host=db',

'user' => 'developers',

'password' => '',

'type' => 'pgsql',

),

'db2' => array (

'DSN' => 'pgsql:dbname=matrix;host=db',

'user' => 'developers',

'password' => '',

'type' => 'pgsql',

),

'db3' => array (

'DSN' => 'pgsql:dbname=matrix;host=db',

'user' => 'developers_secondary',

'password' => '',

'type' => 'pgsql',

),

'dbcache' => NULL,

);



return $db_conf;[/quote]



When I did this, I used the example from the postgre install page, rather than the normal install page. There are two different ones posted. Try the db info on the postgresql page.


    		'db' => array (
    				'DSN' => 'pgsql:dbname=mysource_matrix',
    				'user' => 'matrix',
    				'password' => '',
    				'type' => 'pgsql',
    			   ),
    		'db2' => array (
    				'DSN' => 'pgsql:dbname=mysource_matrix',
    				'user' => 'matrix',
    				'password' => '',
    				'type' => 'pgsql',
    			   ),
    		'db3' => array (
    				'DSN' => 'pgsql:dbname=mysource_matrix',
    				'user' => 'matrix_secondary',
    				'password' => '',
    				'type' => 'pgsql',
    			   ),
    		'dbcache' => array (
    				'DSN' => 'pgsql:dbname=mysource_matrix',
    				'user' => 'matrix',
    				'password' => '',
    				'type' => 'pgsql',
    			   ),


At least this worked for me...

thanks! im just that little bit closer :)’ /> now i need to hunt around for anyone who has this error at the end of step2 <img src=‘http://forums.matrix.squiz.net/public/style_emoticons/<#EMO_DIR#>/smile.gif’ class=‘bbc_emoticon’ alt=’:slight_smile:


[codebox]Fatal error: Uncaught exception ‘PDOException’ with message ‘SQLSTATE[42883]: Undefined function: 7 ERROR: function sq_grant_access(unknown) does not exist

LINE 1: SELECT sq_grant_access($1)

^

HINT: No function matches the given name and argument types. You might need to add explicit type casts.’ in /usr/local/web/mysource_matrix/core/lib/DAL/DAL.inc:601

Stack trace:

#0 /usr/local/web/mysource_matrix/core/lib/DAL/DAL.inc(601): PDOStatement->execute()

#1 /usr/local/web/mysource_matrix/core/lib/db_install/db_install.inc(724): DAL::execPdoQuery(Object(PDOStatement))

#2 /usr/local/web/mysource_matrix/install/step_02.php(121): grant_secondary_user_perms()

#3 {main}

thrown in /usr/local/web/mysource_matrix/core/lib/DAL/DAL.inc on line 601[/codebox]


Looks like your step_02.php broke on an earlier run and now the stored procedures are missing. Ensure you have PL/PgSQL installed in your database:

    $ createlang plpgsql database_name


You may have more success if you drop the database, recreated it, add the PL/PgSQL language and start the install again. :)

sigh, tried that - also tried removing postgres itself and reinstalled - language was put in okay - seems to be related to the secondary user account permissions (mysource_secondary) - i can see both accounts (login roles) in the postgres system (pgAdmin III) - the matrix user has listed under dependents the following statement:


Type: Table

Database: mysource_matrix

Name: public.sq_cache



but there are no listings in the matrix_secondary / dependents area.



ill keep trawling the web to find out more about setting up login roles in postgres. any help is, of course, welcome …


Matrix does this for you when it runs step_02.php -- you shouldn't have to do anything except create both roles.

okay its beer o'clock - step 2 worked that time! the only thing i did different was to stop the postrgres server and then start it again. onto step 3 before my luck runs out!


update: step3 worked, apache setup was a breeze and after one issue with servername vs ip address i logged in. thanks for the help and hopefully my struggle will help others in similar situations. i noticed the postgres page on the squiz site has been updated - makes it easier to work out how to setup the 3.18.1 strain with postgres 8.3.



if anyone is slightly bit interested, my install was on ubuntu 8.04.