From: six at aegis-corp dot org
Operating system: linux 2.6
PHP version: 5.3.1RC2
PHP Bug Type: PDO related
Bug description: pdo_mysql doesn't use PHP_MYSQL_UNIX_SOCK_ADDR
Description:
------------
since 5.3.0, the PDO Mysql driver doesn't use the --with-mysql-sock
configure option (help says : --with-mysql-sock[=DIR]
MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer.) and
always uses /tmp/mysql.sock.
Patch below:
--- pdo_mysql.c.orig 2009-10-27 18:02:56.000000000 +0100
+++ pdo_mysql.c 2009-10-27 19:15:38.000000000 +0100
@@ -40,7 +40,11 @@
#ifndef PHP_WIN32
# ifndef PDO_MYSQL_UNIX_ADDR
-# define PDO_MYSQL_UNIX_ADDR "/tmp/mysql.sock"
+# ifdef PHP_MYSQL_UNIX_SOCK_ADDR
+# define PDO_MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR
+# else
+# define PDO_MYSQL_UNIX_ADDR "/tmp/mysql.sock"
+# endif
# endif
#endif
Reproduce code:
---------------
./configure --with-mysql-sock=/var/run/mysqld/mysqld.sock [...] && make &&
make install
and then:
php -r 'new PDO("mysql:host=localhost");'
Expected result:
----------------
nothing
Actual result:
--------------
Warning: PDO::__construct(): [2002] No such file or directory (trying to
connect via unix:///tmp/mysql.sock) in Command line code on line 1
--
Edit bug report at http://bugs.php.net/?id=50023&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50023&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50023&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50023&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50023&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50023&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50023&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50023&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50023&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50023&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50023&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50023&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50023&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50023&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50023&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50023&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50023&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50023&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50023&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50023&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50023&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50023&r=mysqlcfg