FAQ
Hi!

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.

gruß, Roland
--
"Ich kenne niemanden, der nachts vom
Kiffen nach Hause kommt und seine Frau schlägt."

Search Discussions

  • Sara Golemon at Oct 3, 2004 at 1:27 am

    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
  • Andrey Hristov at Oct 3, 2004 at 8:12 am

    Roland Tapken wrote:
    Hi!

    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.

    gruß, Roland
    Hi,
    I think it is well mentioned in MySQL's docs that localhost has special
    meaning for MySQL and when it is specified the client tries to connect
    using unix socket(non-win32). As Sara said, the workaround is 127.0.0.1

    Andrey

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-internals @
categoriesphp
postedOct 3, '04 at 12:39a
activeOct 3, '04 at 8:12a
posts3
users3
websitephp.net

People

Translate

site design / logo © 2022 Grokbase