Could not connect to the database, see error message below.
No error message given.
I was able to connect just fine using phpPgAdmin, I was also able to connect just fine using the pgsql example code on php.net.
In phpBB3s' DB code for PostgreSQL,
(phpBB3/includes/db/postgres.php)
on lines 55-57 was the following code.
if ($sqlserver !== 'localhost')
{
$connect_string .= "host=$sqlserver ";
}
As soon as I commented out the if-condition like this,
//if ($sqlserver !== 'localhost')
//{
$connect_string .= "host=$sqlserver ";
//}
entered localhost, & entered my port number in the connection details,
the connection test passed.
Update 12/23/2007
This appears to have somthing to do with the way pg_connect attempts to connect to the PostgreSQL server.
More details in my bug report at phpbb.com
Attempts should probably be made to allow PHP to connect using a UNIX domain socket since that method is supposed to be faster than the TCP method specifying localhost defaults to.
But to just git r done, commenting out the if-condition as I did should get things up and running.
Update 12/28/2007
I've got a UNIX domain socket listening for PostgreSQL now. The socket began registering itself after a system update required a reboot.
So if you've recently installed PostgreSQL & have an issue like this, you should try rebooting the system and see if the domain socket registers itself.
An interesting note: I have another installation of phpBB3 on the same server, the default install used about 350KB of space in the MySQL install & 8.5MB for the PostgreSQL install.
6 comments:
Hi, thank you for your post. Unfortunatelly it didn't work out for me :(
--
Valery
Sadly and not for me.
cat /var/log/postgresql/postgresql-8.3-main.log
gives:
2008-03-26 14:05:16 EET FATAL: Ident authentication failed for user "drupal5"2008-03-26 14:05:16 EET
I believe there is some isue with pg_connect string
Once again!
In fact there is isue with authentification to postgres.
As log gives, phpbb tries authentificate like "password" method and in my case in postgres config is told that databases should authentificate like "ident".
http://www.postgresql.org/docs/8.3/static/client-authentication.html
Has clear view about authentification methods.
I have changed /etc/postgre/8.3/main/pg_hba.conf
that phpbb database should be connected like "password" method and this solves problem.
$connect_string shall be as follows:
"host='localhost' user='postgres' password='' dbname='phpbb'"
Check and correct /includes/db/postgres.php
Works like a charm!
Previously I changed pg_hba.conf to always ask for md5, but then I couldn't login as postgres anymore. This way the socket connection can stay on 'ident sameuser'!
Alternatively, under Ubuntu, you can use a newly created PostgreSQL user called www-data, so that Ident Auth can be successful - 'www-data' is the unix user account apache runs under. You might want to change this to a siutable version for your system. Also, don't forget to create an appropriate database owned by this new user.
Post a Comment