Re: PHP 4.0 Bug #5823: PHP assumes MySQL unix socket is always available

From: Date: Mon, 31 Jul 2000 08:45:54 +0000
Subject: Re: PHP 4.0 Bug #5823: PHP assumes MySQL unix socket is always available
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-27005@lists.php.net to get a copy of this message
Rasmus Lerdorf wrote: > It does ship with some. Like both Posix and PCRE regex libraries for > example. Shipping with regex libraries is (as I understand it) a convenience feature. Normal regex is always needed (since it's "core" feature and some systems have broken libc regex), pcre is almost always used too. Also, pcre is pretty stable target, it's not like something would break if you stay using some older version instead of the most current one. And there is pretty low chance the user would already have it installed, too. On the other hand, MySQL is moving target. Client libraries have to match what's installed as server, e.g. you need 3.23 client libraries if using MySQL 3.23 server, instead of 3.22 ones. There might be other issues as well. And, to be fair, if you are shipping with MySQL libs, you should ship with msql, pgsql, readline & other libraries required by any other extension as well :-) > However, you are changing the discussion. I don't like your patch because > it will adversely affect a lot of people. An extra stat() and the > obscurity of falling back to slow TCP connections. It's one stat(2) per life of the each respective httpd process. As I said previously, I don't think PHP should baby-sit specially configured machines and should not assume that there is a misconfiguration if the unix socket is not where it's supposed to be. If people want to make sure the unix socket is used, they can specify it explicitly. They have to do that anyway if the location of unix socket differs from the 'default', right ? Using unix socket if 'localhost' is specified as the connect host is nice hack, but since the connection to unix socket was not explicitly requested, it should fall back to TCP/IP connection gracefully, if the unix socket is not available for whatever reason. If the code does not do that, it's a bug. The code I sent as patch does exactly that (or should be, modulo bugs:) - if the connect string is 'localhost', it checks whether the unix socket is there and if not, doesn't use it. If the unix socket path was explicitly specified, it does nothing special, so an error would be written to user further down. > In your case you could > work around it by simply connecting to 127.0.0.1 instead of localhost. I do not want to force using TCP/IP. I want it to use the unix socket if it's available, i.e I'd like it to "just work". OK, I'll just use MySQL's mysqlclient instead of the library shipped with PHP, that would solve my problem :-) I'd feel better if there would be no bug I know about in PHP, but since I won't be using that code, I don't really care :) Jaromir -- Jaromir Dolecek <jdolecek@NetBSD.org> http://www.ics.muni.cz/~dolecek/ @@@@ Wanna a real operating system ? Go and get NetBSD, damn! @@@@

« previous php.dev (#27005) next »