|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56315 Unable to create PDO Object
Submitted: 2005-02-21 06:33 UTC Modified: 2005-02-21 11:11 UTC
From: ansriniv at in dot ibm dot com Assigned: hholzgra (profile)
Status: Closed Package: PDO_MYSQL (PECL)
PHP Version: 5.0.3 OS: Linux IA32 RHEL3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: ansriniv at in dot ibm dot com
New email:
PHP Version: OS:


 [2005-02-21 06:33 UTC] ansriniv at in dot ibm dot com

When I am trying to create PDO object with the following 
dsn, i am getting the following error.

Connection failed
SQLSTATE[HY000] [2005] Unknown MySQL server host '.' (4)

However, if i change the dsn string to something like 
there seem to be no problem.

AS you can see, in the second case, i am passing the host IP address instead of string 'localhost';

my /etc/hosts file looks like below.

<root@localhost /opt/IBMIHS/htdocs/en_US> cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.               localhost.localdomain localhost               localhost

I am using IHS with PHP 5.0.3 on IA32 box running with RHEL3,

I am not sure whether this is a bug, or is there any thing silly which I am missing.

Thank you,

Reproduce code:


try {
    $dbh = new PDO($dsn, $user, $password);
    print "PDO Object has been created </br>";
} catch (PDOException $e) {
    print "Connection failed </br>" . $e->getMessage();

Expected result:
PDO Object has been created

Actual result:
Connection failed
SQLSTATE[HY000] [2005] Unknown MySQL server host '.' (4)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-21 11:11 UTC]
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on

In case this was a website problem, the change will show
up on the website in short time.
Thank you for the report, and for helping us make PECL better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 07:01:30 2024 UTC