php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16821 Cannot connect to local mysql server via socket file
Submitted: 2002-04-25 06:28 UTC Modified: 2002-04-26 06:10 UTC
From: imacat at mail dot imacat dot idv dot tw Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.2.0 OS: Linux 2.2.17/2.4.8
Private report: No CVE-ID: None
 [2002-04-25 06:28 UTC] imacat at mail dot imacat dot idv dot tw
I think nobody has reported this before.  I cannot connect to  the mysql server on the localhost via the mysql socket file, neither with mysql.default_socket in php.ini, or with mysql_connect() or mysql_connect("localhost:/path/to/socket").  It was working till PHP 4.1.2.  I have checked the phpinfo() and seen that the php.ini was indeed loaded.  (Some options are actually tweaked.)  I have also checked that the webserver user (nobody) has indeed the previledge to read from/write to that socket file.  I can su as nobody and connect to the local mysql server via the socket file (I use skip-networking) with the console mysql client.  No password is required for nobody.  I have also checked the mysql log file and see no log record on this.  The error message I obtained from PHP is:

Warning: Can't connect to MySQL server on 'localhost' (111) in /local/home/imacat/public_html/test.php on line 26

Warning: MySQL Connection Failed: Can't connect to MySQL server on 'localhost' (111)
 in /local/home/imacat/public_html/test.php on line 26

But, if I connect via TCP/IP (comment out skip-networking), everything goes fine.

I can't go any further except recompile and debugging the PHP source code, but it's not possible, since it is on a slow development server.  I wish this above infomation could be helpful, or at least someone could tell me where I went wrong, that I could connect in the past but cannot connect now.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-25 06:31 UTC] derick@php.net
You are the third :) But thinks for this thourough report. It will be fixed in 4.2.1.

Derick
 [2002-04-26 04:51 UTC] imacat at mail dot imacat dot idv dot tw
Thank you. ^_*'

    But I don't think so.  I did have searched the bug database and read several reports.  I even searched on the google.  But I did not find this same bug report on PHP 4.2.0.  Yes, I did find 2 same bug reports on PHP 4.0.5 and PHP 4.0.6.  I thought they were different problems, though, since they apply to PHP 4.0.x, and since it works on PHP 4.1.x.  I did not test this on PHP 4.0.x, since I start using mysql local socket file and "skip-networking" on PHP 4.1.x.

    You can ignore this.  But if you have time, maybe you can  tell me which 2 previous bug reports (bug no#) I have missed.  I don't like the feeling of asking duplicated questions and wasting network resources, without knowing why.

    Sorry for this, and thank you for reading.  I'm waiting for PHP 4.2.1 now.
 [2002-04-26 06:10 UTC] mfischer@php.net
In fact, you don't have to wait for this fix.

4.2.0 was packed with configure script made by autoconf 2.52 which doesn't seem to work correcly.
configure built with autoconf 2.13 works fine.

Resolutions:
* wait for 4.2.1 (due in a week or so)
* if you have autoconf 2.13 on you system, delete configure and run ./buildconf in php-4.2.0/
* download configure script from http://www.edin.dk/php/configure.gz

Closing since the bug is detect and will be fixed.
 [2002-05-07 10:48 UTC] imacat at mail dot imacat dot idv dot tw
Yes, it is fixed.  The new autoconf configure script work fine.  Thank you. ^_*'
 [2002-06-06 12:10 UTC] jacob at gnu dot org
yesterday I upgraded my php to 4.2.1 from 4.0.6 or something else and I am experiencing this problem.  If it has been fixed, what does this fix do and where is the bug so I can try to fix mine.

whoozle

~jacob
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 27 07:00:02 2025 UTC