I have never used Postgres but shouldn't you specify only the folder
where the socket is located for Postgres?

>From what I can read of how the connection works you should:
host == folder to socket
port == null

The manual page you link to describes database configs in general.
My interpretation is that some dbo's take a socket and some do not.

If you can't get it to work by specifying the host as the path then
you can quite easily write your own version of the connect method and
add an if or two in there to format the connection string correctly
for socket connections.

Create a new dbo in your app folder (models/datasources/dbo/) and call
it "dbo_postgres_sock.php" or something. Extend the original posgres
dbo, copy the connect method from the original and make a few changes.

/Martin


On Jun 8, 11:37 am, "die...@be" <[email protected]> wrote:
> Hi,
> is it just me, or does connecting to a postgresql database through a
> unix socket not work?
> The documentation (http://book.cakephp.org/view/40/Database-
> Configuration) says I can put the socket path in the 'port' field of
> the database config, so I did that:
>
>         var $production = array(
>                 'driver' => 'postgres',
>                 'persistent' => false,
>                 'host' => 'localhost',
>                 'port' => '/var/run/postgresql/.s.PGSQL.5432',
>                 'login' => 'bar',
>                 'password' => 'foo'
>                 'database' => 'baz',
>                 'prefix' => '',
>         );
>
> But when I try to load a page, cake says:
>
> Unable to connect to PostgreSQL
> server: could not connect to server: Connection timed out Is the
> server running on host "localhost" and accepting TCP/IP connections on
> port /var/run/postgresql/.s.PGSQL.5432?
>
> In fact, I could not find anything related to connections to unix
> sockets other then with mysqli:
>
> grep -R socket cake/libs/model/
> cake/libs/model/datasources/dbo/dbo_mysqli.php:                 
> $config['socket'] =
> null;
> cake/libs/model/datasources/dbo/dbo_mysqli.php:                 
> $config['socket'] =
> $config['port'];
> cake/libs/model/datasources/dbo/dbo_mysqli.php:         $this->connection =
> mysqli_connect($config['host'], $config['login'], $config['password'],
> $config['database'], $config['port'], $config['socket']);
>
> I'm using Cake 1.2.2.8120
>
> Thanks,
> Dieter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to