php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45179 --with-mysql-sock fails to compile & work
Submitted: 2008-06-04 17:18 UTC Modified: 2008-07-21 18:14 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: daniel dot fallon at nuim dot ie Assigned: andrey (profile)
Status: Closed Package: MySQL related
PHP Version: 5.2.6 OS: CentOS 4.5
Private report: No CVE-ID: None
 [2008-06-04 17:18 UTC] daniel dot fallon at nuim dot ie
Description:
------------
When using --with-mysql=/usr/local/mysql and having a nonstandard socket (/home/databases/mysql/mysql.sock), the compiler throws a warning and fails to compile PHP with the socket that was given via the --with-mysql-sock option

I'm using PHP 5.2.6 and mySQL 5.0.51b (compiled from source)

/bin/sh /usr/src/php-5.2.6/libtool --silent --preserve-dup-deps --mode=compile gcc  -Iext/mysql/ -I/usr/src/php-5.2.6/ext/mysql/ -DPHP_ATOM_INC -I/usr/src/php-5.2.6/include -I/usr/src/php-5.2.6/main -I/usr/src/php-5.2.6 -I/usr/include/libxml2 -I/usr/src/php-5.2.6/ext/date/lib -I/usr/local/mysql/include/mysql -I/usr/src/php-5.2.6/TSRM -I/usr/src/php-5.2.6/Zend    -g -O2  -prefer-non-pic -c /usr/src/php-5.2.6/ext/mysql/php_mysql.c -o ext/mysql/php_mysql.lo 
In file included from /usr/local/mysql/include/mysql/mysql.h:71,
                 from /usr/src/php-5.2.6/ext/mysql/php_mysql.c:67:
/usr/local/mysql/include/mysql/mysql_version.h:18:1: warning: "MYSQL_UNIX_ADDR" redefined
In file included from /usr/src/php-5.2.6/TSRM/tsrm_config.h:1,
                 from /usr/src/php-5.2.6/TSRM/tsrm_config_common.h:13,
                 from /usr/src/php-5.2.6/TSRM/tsrm_virtual_cwd.h:26,
                 from /usr/src/php-5.2.6/main/php.h:412,
                 from /usr/src/php-5.2.6/ext/mysql/php_mysql.c:32:
/usr/src/php-5.2.6/include/../main/php_config.h:1891:1: warning: this is the location of the previous definition


Reproduce code:
---------------
./configure 
--with-pear=/usr/lib/pear --with-mysql=shared,/usr/local/mysql --with-mysql-sock=/home/databases/mysql/mysql --with-zlib-dir=/usr/include --with-zlib=shared --with-apxs2=/usr/local/apache2/bin/apxs

Expected result:
----------------
PHP to throw no warnings during compile and use the new socket that I defined through configure.

I expect phpinfo()'s MYSQL_SOCKET value to report the specified socket

Actual result:
--------------
phpinfo() shows MYSQL_SOCKET as /tmp/mysql.sock which is the value in mysql_version.h 

There's a number of previous bug reports for this same issue, I don't know what's happening to the fixes but it's not working at the minute.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-04 18:21 UTC] teefee at test dot com
A suggested fix (elsewere) was simply to encase the #define MYSQL_UNIX_ADDR statement in mysql_version.h in an #ifndef/#endif pair.
This appears to work on the face of things, with no warnings and phpinfo() reporting MYSQL_SOCKET as the socket defined in configure.

However, PHP still looks to /tmp/mysql.sock for the socket which results in a connection failure.
 [2008-07-21 18:14 UTC] andrey@php.net
This bug has been fixed in CVS.

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

Thank you for your report!
From now on, --with-mysql-sock will apply to all 3 MySQL extensions:
- ext/mysql
- mysqli
- pdo_mysql
It will be the default value for the socket connections unless another value is specified in php.ini (.htaccess)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 21:01:29 2024 UTC