Welcome to WebmasterWorld Guest from 34.204.173.36

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

can't connect to mysql with php, help!

     
3:23 pm on Jan 14, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 2, 2001
posts:597
votes: 0


warning: noob with server!

ok, so I have php and mysql running but I can get any of my php scritps to connect to mysql.

what would the common problems here be? I think I have the basic covered (as far as the scripts pointing to the right place and stuff like that), I think I must have something on the server side wrong, but I have no clue what...

I'm running PHP 4.3.2, and in the PHP Info page I see:

'--with-mysql=shared,/usr'

In the configure section, which I think is right?

Any ideas what's wrong here, or what else I should look at would be greatly appreciated.

Thanks!

5:01 pm on Jan 15, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 2, 2001
posts:597
votes: 0


ok, here's a few more details of my set up that may help:

# rpm -qa ¦ grep php

php-ldap-4.3.2-23.ent
php-mysql-4.3.2-3mdk
php-imap-4.3.2-23.ent
php-4.3.2-23.ent

# rpm -qa ¦ grep php

php-ldap-4.3.2-23.ent
php-mysql-4.3.2-3mdk
php-imap-4.3.2-23.ent
php-4.3.2-23.ent

RedHat 3.2ES

my server has been useless for weeks due to this, does anyone have a clue what is wrong here? TIA!

10:08 pm on Jan 15, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 28, 2004
posts:151
votes: 0


So php_info() works and mysql works, from what I get. Could you post (or sticky) the script your using to connect?
3:50 pm on Jan 16, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 2, 2001
posts:597
votes: 0


sure, this is it:

<?php
$link = mysql_connect('localhost', 'vgbxwz9', '123456');
if (!$link) {
die('Not connected : ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);

?>