Re: mysql_connect('localhost') should use tcp/ip instead of socket
| From: | Sara Golemon | Date: | Sun, 03 Oct 2004 01:26:57 +0000 |
| Subject: | Re: mysql_connect('localhost') should use tcp/ip instead of socket | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-13111@lists.php.net to get a copy of this message | ||
> When using 'localhost' in mysql_connect(), php tries to
> use a socket to connect to the mysql daemon. Is there
> a way to force php to resolve the hostname of localhost,
> maybe by patching some source file? The reason is that
> a socket is not avaible because mysql and apache are
> running in different chroot jails on my server.
>
Actually that's libmysql doing that, not PHP. The way around that
"shortcut" is to connect to 127.0.0.1 (by ip) rather than localhost (by
name) which of course you can handle in your script code without having to
patch PHP or libmysql directly.
-Sara