Page 1 of 1
[Help] How can I make mysql_pconnection(...) work?
Posted: Thu Mar 11, 2004 9:13 pm
by river001
(Maybe it's another foolish question, but I almost don't know anything about "l+a+m+p", please help me)
I am using linux+apache+mysql+php solution.
In the scripts, there are codes like this:
<?php
@$c = mysql_pconnect("localhost", "root", "password") ;
print "ok?" ;
?>
But I found the "ok?" cannot be displayed. It seems somethings like an exception occurs when mysql_pconnect() is called.
I am sure that root's password is "password" and mysql runs ok.
So what's the problem.
Thanks a million!
Posted: Thu Mar 11, 2004 9:18 pm
by Illusionist
try this:
Code: Select all
$c = @mysql_pconnect("localhost", "root", "password") or die("ERROR: ".mysql_error());
Posted: Thu Mar 11, 2004 10:03 pm
by TheBentinel.com
Illusionist wrote:
$c = @mysql_pconnect("localhost", "root", "password") or die("ERROR: ".mysql_error());
Is the user name and password sent to mysql_pconnect referring to the user login's on the O/S, or a separate list of users within MySQL? If it's a list of users in the database, maybe you don't have a user named "root" in your db.
Sorry if this is way off, I'm very new to MySQL.
Posted: Thu Mar 11, 2004 10:13 pm
by river001
TheBentinel.com wrote:
If it's a list of users in the database, maybe you don't have a user named "root" in your db.
I think there's a user named "root", after you install mysql for the first time, the user "root" is there and the password of root is "" at that point of time.
I am very new to MySql too, anyway, I've tried other accounts of mysql, the same thing happens.
Thank you anyway!
Posted: Thu Mar 11, 2004 10:15 pm
by TheBentinel.com
Illusionist wrote:try this:
Code: Select all
$c = @mysql_pconnect("localhost", "root", "password") or die("ERROR: ".mysql_error());
What error message does it print?
Posted: Thu Mar 11, 2004 10:17 pm
by Illusionist
well.. did u try my code?? if so what happened?? root i think is always default when installing mysql, and i think its password is just blank, but i may be wrong. anyways try the code i suggested and see if you get anywhere.
Posted: Thu Mar 11, 2004 10:42 pm
by river001
Illusionist wrote: anyways try the code i suggested and see if you get anywhere.
I tried your codes 2 minutes ago. and I got the same result --- a white a page was displayed. Any codes after "mysql_pconnect()" have been ignored, even mysql_error() didn't response.
What the hell is going on?

Posted: Thu Mar 11, 2004 11:15 pm
by Illusionist
are you sure you have PHP working on your server??
create a new php page(*.php) with only this in it:
and see if you get anything....
Posted: Thu Mar 11, 2004 11:31 pm
by river001
I am pretty sure php engine is working.
I tried <?php phpinfo() ?> already.
Posted: Fri Mar 12, 2004 9:13 am
by river001
I took "@" off, and the error message is:
"Fatal Error: Call to undefined function:mysql_pconnect()...."
I am very new to php, it seems php hasn't been set up correctly.
How can I solve the problem. Thanks a million!
Posted: Fri Mar 12, 2004 9:25 am
by penguinboy
Posted: Fri Mar 12, 2004 9:48 am
by TheBentinel.com
river001 wrote:"Fatal Error: Call to undefined function:mysql_pconnect()...."
Maybe try mysql_connect? Looking at the docs that PB referenced, it looks like pconnect was a later addition that you may not have. (What version of PHP are you running?)
I think you'd get that error when you call any undefined function. If you changed it to mysql_NoSuchFunction, you'd probably get the same error.
Posted: Fri Mar 12, 2004 9:59 am
by river001
I get the following information:
the PHP binary that Red Hat 8.0 provides was compiled without MySQL support.
That's the problem, I got to reinstall php.
Thank all the people who gave me helps.