From Bugzilla Helper: User-Agent: Mozilla/4.77 [en] (X11; U; SunOS 5.7 sun4u) Description of problem: php-mysql-4.0.6-12 looks for MySQL's socket in /tmp/mysql.sock, but Red Hat 7.2's mysql RPMs place this socket in /var/lib/mysql.sock. This can make mysql_connect fail in this version where it worked previously. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. Write PHP code of the form: $db = mysql_connect($mysqlhost, $mysqluser, $mysqlpasswd) or die("Could not connect to MySQL."); print "We connected."; 2. Place PHP code in file on web server with this RPM installed, and visit the page with the PHP code. Actual Results: Error message: Warning: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in whatever.php on line 7 Could not connect to MySQL. Expected Results: Database connection should be made and PHP script should continue execution. In the above example "We connected." should appear, not "Could not connect to MySQL." Additional info: This can be worked around by editing /etc/php.ini and setting mysql.default_socket = /var/lib/mysql/mysql.sock then restarting httpd.
ditto. I can recreate this case. same fix - but it should follow what mysql_config outputs for the socket location.
Additionally - the configure script for php has: if test "$PHP_MYSQL" = "yes"; then echo $ac_n "checking for MySQL UNIX socket""... $ac_c" 1>&6 echo "configure:29800: checking for MySQL UNIX socket" >&5 MYSQL_SOCK=/tmp/mysql.sock for i in \ /var/run/mysqld/mysqld.sock \ /var/tmp/mysql.sock \ /var/lib/mysql/mysql.sock \ /var/mysql/mysql.sock \ ; do if test -r $i; then MYSQL_SOCK=$i fi done it should really just call mysql_config --socket and use that value as the sock location. then you can build it based on the lib NOT the current config on the build system
*** Bug 60623 has been marked as a duplicate of this bug. ***
Not to be a nag, but any movement on new pkgs to fix this? I'm waiting to roll out these patches and I'd rather not have to hand edit each php.ini for all those systems if possible. At the same time I don't like having this php bug sitting open either :) Thanks
*sigh* ok this is whats happening the mysql.sock named socket only exists when mysqld is RUNNING. The build system here obviously doesn't have every last daemon running so /var/lib/mysqld.sock doesn't exist durring the compilation. The default config.m4, when it doesn't find the socket in any of the proposed places sets MYSQL_SOCK=/tmp/mysql.sock as a last ditch attempt to make the world a better place. Fortunately as you already know, you can OVERRIDE the compiled in default in /etc/php.ini locate the line 'mysql.default_socket =' and type in /var/lib/mysql/mysql.sock That should sort you out, though you should always read through and tweak the /etc/php.ini file as appropriate for your configuration I've patched the default php.ini for the next errata (should be a 4.1.2 errata at some point) Phil =--=
wouldn't it make more sense to fix the configure script to reference mysql_config --socket rather than patch the ini to fix it for THIS one case. that way - in the future if the mysql's named socket location changes in the mysql package then you don't have to huntdown the modification to php.ini - it will just FIX the problem. Then to keep from having to apply that patch forever, it might be worthwhile to send it upstream to the php folks - its a patch that makes sense no matter what os someone is building php on.
*** Bug 60542 has been marked as a duplicate of this bug. ***
Well thats kinda what I did! basically if I can find mysql_config, use it else hard code the bugger to /var/lib/mysql wonder if upstream will consider taking this as it's silly to expect mysql to be running to get the location of the named socket. Phil =--= --- php-4.1.2/ext/mysql/config.m4.orig Mon Mar 4 14:17:09 2002 +++ php-4.1.2/ext/mysql/config.m4 Mon Mar 4 14:30:09 2002 @@ -17,18 +17,23 @@ AC_DEFUN(PHP_MYSQL_SOCK,[ AC_MSG_CHECKING(for MySQL UNIX socket) - MYSQL_SOCK=/tmp/mysql.sock - for i in \ - /var/run/mysqld/mysqld.sock \ - /var/tmp/mysql.sock \ - /var/lib/mysql/mysql.sock \ - /var/mysql/mysql.sock \ - /Private/tmp/mysql.sock \ - ; do - if test -r $i; then - MYSQL_SOCK=$i - fi - done + if test -x /usr/bin/mysql_config; then + MYSQL_SOCK=`/usr/bin/mysql_config --socket` + else + MYSQL_SOCK=/var/lib/mysql/mysql.sock + for i in \ + /var/run/mysqld/mysqld.sock \ + /var/tmp/mysql.sock \ + /var/lib/mysql/mysql.sock \ + /var/mysql/mysql.sock \ + /Private/tmp/mysql.sock \ + ; do + if test -r $i; then + MYSQL_SOCK=$i + fi + done + fi + AC_DEFINE_UNQUOTED(MYSQL_UNIX_ADDR, "$MYSQL_SOCK", [ ]) AC_MSG_RESULT($MYSQL_SOCK) ])
oh cool. The way you described it - I thought you said you had patched the default php.ini file -not the configure for building
Well,.. I'm kinda going to have to patch the php.ini file anyway for the .dll mess 8/ otherwise rpm -V will always get upset Never a dull moment...
*** Bug 60731 has been marked as a duplicate of this bug. ***
regarding that 4.1.2 errata - has it made it into QA yet? is it imminent or eventual?
I'm hoping that if teh rawhide version stands up ok I'll have it in with QA next week.
*** Bug 60739 has been marked as a duplicate of this bug. ***
*** Bug 60749 has been marked as a duplicate of this bug. ***
*** Bug 60774 has been marked as a duplicate of this bug. ***
*** Bug 60840 has been marked as a duplicate of this bug. ***
*** Bug 61619 has been marked as a duplicate of this bug. ***
*** Bug 61401 has been marked as a duplicate of this bug. ***
Does php-4.0.6-15 from RH 7.2 updates solve the problem?