Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.12.3

Bug #5982 No connection with PostgreSQL via sockets and non default port
Submitted: 2005-11-16 11:42 UTC
From: r dot m dot guerrero at usit dot uio dot no Assigned: lsmith
Status: Closed Package: DB
PHP Version: 4.3.11 OS: Linux RHEL WS 3
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 17 + 9 = ?

 
 [2005-11-16 11:42 UTC] r dot m dot guerrero at usit dot uio dot no
Description: ------------ System: - PostgreSQL 8.0.4 (socket in f.ex:/tmp/sockets/, port= 5433) - PHP 4.3.11 - Apache 1.3.33 - pear DB 1.7.6 Using postgreSQL with a non standard port (f.ex.: 5433) would create the Unix domain socket /tmp/sockets/.s.PGSQL.5433. With the actual format of DSN, we can not define a non standard socket location with a non standad port. We can define this: pgsql://postgres@unix(/tmp/sockets/)/test but this will try to connect to tmp/sockets/.s.PGSQL.5432 (default port) and it does not work if we are using another port. "...(/tmp/sockets/:5433)" does not work, this tries to use /tmp/pg_sockets/bbking01:5433/.s.PGSQL.5432 I have patched DB.php (see patch) so it will be possible to define a socket directory and a port in DSN with the format: phptype://user:passwd@unix(/path/to/socket:port)/database Test script: --------------- --- DB.php 2005-11-16 12:25:59.000000000 +0100 +++ DB_patched.php 2005-11-16 12:25:07.000000000 +0100 @@ -816,8 +816,13 @@ class DB $parsed['hostspec'] = $proto_opts; } } elseif ($parsed['protocol'] == 'unix') { - $parsed['socket'] = $proto_opts; - } + if (strpos($proto_opts, ':') !== false) { + list($parsed['socket'], + $parsed['port']) = explode(':', $proto_opts); + } else { + $parsed['socket'] = $proto_opts; + } + } // Get dabase if any // $dsn => database

Comments

 [2006-03-01 23:31 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!