Re: PHP 4.0 Bug #5823: PHP assumes MySQL unix socket is always available
| From: | Jarom�r Dole�ek | Date: | Sun, 30 Jul 2000 09:13:26 +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-26902@lists.php.net to get a copy of this message | ||
Rasmus Lerdorf wrote:
> The problem I see with this patch is that it only checks to see if the
> unix domain socket is there, not whether it is supported on the
> system.
The unix sockets are supported virtually on any Unix-like system.
If you mean if they are supported/used by MySQL - that is ~impossible
to do, if you do not want to resort to some dirty hackery.
> It is not uncommon for the mysql client library and the server to
> disagree on where this unix domain socket is supposed to be.
This is fatal configuration error. They should only disaggree if
the administrator messed with client code, in which case
they would be very aware of supposed ramifications. Particalirily,
I don't think that PHP should baby-sit such broken configurations
or incompetent admins, and should just use whatever communication
type is available, i.e. TCP/IP if the unix socket is not where
it's supposed to be.
> This patch
> would hide the error message and silently fall back to TCP and people
> would never know they are using the slower TCP mechanism.
How much faster is unix socket, BTW ?
Even silent failing would be better than current state, where the
user would be unable to run PHP with MySQL at all. We can probably
get away with a one-time warning to server log or on level E_NOTICE.
And, BTW - this chunk of code seems to only used if PHP is compiled
with it's bundled mysql code and it should be OK when using
mysqlclient library. IMHO PHP should not have any bundled MySQL
client library at all and just rely on that of system it's compiled
on. Besides unnecessary bloat (it adds about 150KB compressed to
distibution tar.gz, and about 100KB to compiled libphp4.so if used
instead of shared mysqlclient), this would prevent lossages like
the one described in the PR. Or, optionally, distribute PHP with
client libraries for all extensions you support ;-), for consistency
sake.
BTW, configure should try to find the system libraries for --with-mysql
without directory name on couple of common places (/usr/local,
/usr/pkg, /usr/ports), at the very least. I was quite surprised
when I found out that I have to specify a directory to --with-mysql
switch for it to actually use MySQL own libraries (mysqlclient) instead
of the bundled one.
Jaromir
--
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.ics.muni.cz/~dolecek/
@@@@ Wanna a real operating system ? Go and get NetBSD, damn! @@@@