[Help] How can I make mysql_pconnection(...) work?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
river001
Forum Newbie
Posts: 10
Joined: Thu Mar 11, 2004 6:14 pm
Location: Ontario, Canada

[Help] How can I make mysql_pconnection(...) work?

Post 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!
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

try this:

Code: Select all

$c = @mysql_pconnect("localhost", "root", "password") or die("ERROR: ".mysql_error());
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Post 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.
river001
Forum Newbie
Posts: 10
Joined: Thu Mar 11, 2004 6:14 pm
Location: Ontario, Canada

Post 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!
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Post 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?
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post 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.
river001
Forum Newbie
Posts: 10
Joined: Thu Mar 11, 2004 6:14 pm
Location: Ontario, Canada

Post 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? :?:
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

are you sure you have PHP working on your server??
create a new php page(*.php) with only this in it:

Code: Select all

<?php
phpinfo()
?>
and see if you get anything....
river001
Forum Newbie
Posts: 10
Joined: Thu Mar 11, 2004 6:14 pm
Location: Ontario, Canada

Post by river001 »

I am pretty sure php engine is working.

I tried <?php phpinfo() ?> already.
river001
Forum Newbie
Posts: 10
Joined: Thu Mar 11, 2004 6:14 pm
Location: Ontario, Canada

Post 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!
penguinboy
Forum Contributor
Posts: 171
Joined: Thu Nov 07, 2002 11:25 am

Post by penguinboy »

TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Post 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.
river001
Forum Newbie
Posts: 10
Joined: Thu Mar 11, 2004 6:14 pm
Location: Ontario, Canada

Post 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.
Post Reply