php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17188 mysql_pconnect sometimes not work
Submitted: 2002-05-13 14:25 UTC Modified: 2002-05-13 14:42 UTC
From: kingyip at bigfoot dot com Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.2.0 OS: Linux 1.3.14
Private report: No CVE-ID: None
 [2002-05-13 14:25 UTC] kingyip at bigfoot dot com
I just upgrade the php from 4.1.2 to 4.2.0 and the only problem I encounter is using the mysql_pconnect. It seems like sometimes working and sometimes not. I am connecting to the mySQL database with the following code:

function connectDB() {
	$link = mysql_pconnect("localhost", "abc.com", "12345");

	if (!$link)
		die("Couldn't connect to MYSQL");
	mysql_select_db("product")
		or die("Couldn't open product: ".mysql_error());
	return $link;
}

Sometimes I get an error of "Warning: Host 'localhost.localdomain' is not allowed to connect to this MySQL server in /mnt/home/apache/public_html/data.php on line 3
Couldn't connect to MYSQL"

I don't know why sometimes the host has been altered to localhost.localdomain, but sometimes it works just perfectly fine. I have no problem on the previous version (4.1.2). I have a solution for this now which is setting the host of the user permission to not only with "localhost" but also with "Any". However I wish this bug can be fixed in the future time. Thanks.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-13 14:27 UTC] mfischer@php.net
Known issue. 4.2.1 is fixed which will be released pretty soon. For a quick fix, rebuild the ./configure script in your php-4.2.0/ directory with autoconf 2.13 (run ./buildconf) and it should work (reconfigure and recompile your source then, better do it on a a fresh archive)
 [2002-05-13 14:42 UTC] derick@php.net
It is already released :)

Derick
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Aug 17 01:00:02 2025 UTC