note 92696 added to ref.pdo-mysql.connection

From: Date: Tue, 04 Aug 2009 13:18:04 +0000
Subject: note 92696 added to ref.pdo-mysql.connection
Groups: php.notes 
Request: Send a blank email to php-notes+get-159083@lists.php.net to get a copy of this message
maybe this is just a bug in php5.3 ... but pdo-mysql seems to have issues between hostname and ip address. for example this fails with pdo exception when using a hostname. <?php $dsn = 'mysql:host=localhost;dbname=test'; $user = 'root'; $password = 'pass'; $dbh = new PDO($dsn, $user, $password); ?> Warning: PDO::__construct() [pdo.--construct]: [2002] Invalid argument (trying to connect via unix://) PDOException: SQLSTATE[HY000] [2002] Invalid argument but this works just fine just changing to ip address. <?php $dsn = 'mysql:host=127.0.0.1;dbname=test'; $user = 'root'; $password = 'pass'; $dbh = new PDO($dsn, $user, $password); ?> this makes no sense since i can connect to mysql from command line with either host or ip. ---- Server IP: 208.69.120.35 Probable Submitter: 67.169.92.224 ---- Manual Page -- http://www.php.net/manual/en/ref.pdo-mysql.connection.php Edit -- https://master.php.net/note/edit/92696 Del: integrated -- https://master.php.net/note/delete/92696/integrated Del: useless -- https://master.php.net/note/delete/92696/useless Del: bad code -- https://master.php.net/note/delete/92696/bad+code Del: spam -- https://master.php.net/note/delete/92696/spam Del: non-english -- https://master.php.net/note/delete/92696/non-english Del: in docs -- https://master.php.net/note/delete/92696/in+docs Del: other reasons-- https://master.php.net/note/delete/92696 Reject -- https://master.php.net/note/reject/92696 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159083) next »