|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49730 Firebird - new PDO() returns NULL
Submitted: 2009-10-01 06:22 UTC Modified: 2010-06-21 23:38 UTC
From: marcink86 at interia dot eu Assigned: felipe (profile)
Status: Closed Package: PDO related
PHP Version: 5.2 only OS: *
Private report: No CVE-ID: None
 [2009-10-01 06:22 UTC] marcink86 at interia dot eu
I created a file test.php:

  $pdo = new PDO("firebird:host=localhost;dbname=TESTDB", "sysdba", "masterkey");

Note that there exists an alias TESTDB to *FDB file in Firebird configuration.

When I 'run' this file in a web browser i get:
object(PDO)#1 (0) { } 
which I think is correct since after var_dump($pdo) I can retrieve records from this database without any problem.

However, in command line ("php test.php" in cmd) var_dump($pdo) returns NULL. Is it correct?
It causes many problems espacially in a Symfony framework (>=1.2) where you build sql files and execute them through command line.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-01 11:03 UTC]
See also Bug #49320 PDO returns null when SQLite connection fails
 [2009-10-01 11:10 UTC] marcink86 at interia dot eu
Note that in my case DSN is correct and NULL should not be returned in CLI.
 [2009-10-02 20:01 UTC] marcink86 at interia dot eu
Anyone to comfirm? Is it going to be fixed?
 [2010-02-04 18:14 UTC] nicolas dot rod at gmail dot com
The DSN in the test.php above is incorrect:

  $pdo = new PDO("firebird:host=localhost;dbname=TESTDB", "sysdba",

it should be:

  $pdo = new PDO("firebird:dbname=localhost:TESTDB", "sysdba",
 [2010-02-04 18:20 UTC] nicolas dot rod at gmail dot com
I forgot to mention that sometimes in Windows you have to modify file c:\windows\system32\drivers\etc\services.
You need to add the following line in order to connect to the GDS services:

gds        3050/tcp            #Firebird Database port number

And that's it.
It took me 2 hours to read the error message and realize what the problem was.
 [2010-06-21 23:33 UTC]
-Operating System: Windows Vista +Operating System: * -PHP Version: 5.2.11 +PHP Version: 5.2 only
 [2010-06-21 23:33 UTC]
I can reproduce it. 5_2 only.
 [2010-06-21 23:38 UTC]
Automatic comment from SVN on behalf of felipe
Log: - Fixed bug #49730 (Firebird - new PDO() returns NULL)
 [2010-06-21 23:38 UTC]
-Summary: Firebird - new PDO() returns NULL in CLI +Summary: Firebird - new PDO() returns NULL -Status: Open +Status: Closed -Assigned To: +Assigned To: felipe
 [2010-06-21 23:38 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Jul 05 07:05:46 2022 UTC