RE: [PHP-DB] Connecting to DB on separate server?
Also the following might give a more useful error message $link=mysql_connect($hostname, $user, $pass) echo mysql_errno() . ": " . mysql_error(). "\n"; Peter --- Excellence in internet and open source software --- Sunmaia Birmingham UK www.sunmaia.net tel. 0121-242-1473 International +44-121-242-1473 --- -Original Message- From: Cassy M Rowe [mailto:cassy@;cassyrowe.com] Sent: 04 November 2002 04:27 To: [EMAIL PROTECTED] Subject: [PHP-DB] Connecting to DB on separate server? I have a php page on server #1 trying to access a database on server #2. What do I put in the following blanks: $hostname: ___ (have tried IP, http, localhost, nothing works) $username: blah $password: blah $database: _ $link=mysql_connect($hostname, $user, $pass) or die("Failure to communicate with database"); $close=mysql_select_db($database, $link); All I get is the "Failure to communicate." message. Server #1: ellerweb.eller.arizona.edu Server #2: datamonster.sbs.arizona.edu $database is cassy, but do I need to add anything to that? I've tried asking two people who are really good at this and they have no answers. THANK YOU IN ADVANCE! Cassy Rowe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Connecting to DB on separate server?
Hi You need to pinpoint where the break in communication is. Does php connect ok to a database on the local machine? no -> php or local MySql config problem? yes -> can you ping the database server from the php server? no -> network problem yes ->MySql problem ->is MySql running no -> start it :) yes -> have you run a GRANT statement that allows access to the database from the php server? If none of the above gives any answers contact me offlist and I will run through some diagnostics with you HTH Peter --- Excellence in internet and open source software --- Sunmaia Birmingham UK www.sunmaia.net tel. 0121-242-1473 International +44-121-242-1473 --- -Original Message- From: Cassy M Rowe [mailto:cassy@;cassyrowe.com] Sent: 04 November 2002 04:27 To: [EMAIL PROTECTED] Subject: [PHP-DB] Connecting to DB on separate server? I have a php page on server #1 trying to access a database on server #2. What do I put in the following blanks: $hostname: ___ (have tried IP, http, localhost, nothing works) $username: blah $password: blah $database: _ $link=mysql_connect($hostname, $user, $pass) or die("Failure to communicate with database"); $close=mysql_select_db($database, $link); All I get is the "Failure to communicate." message. Server #1: ellerweb.eller.arizona.edu Server #2: datamonster.sbs.arizona.edu $database is cassy, but do I need to add anything to that? I've tried asking two people who are really good at this and they have no answers. THANK YOU IN ADVANCE! Cassy Rowe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Connecting to DB on separate server?
On Monday 04 November 2002 12:35, Bob Lockie wrote: > Cassy M Rowe wrote: > > I have a php page on server #1 trying to access a database on server > > #2. What do I put in the following blanks: > > > > $hostname: ___ (have tried IP, http, localhost, nothing works) IP address or the FQDN (obviously it has to be resovable to an IP address). > > $username: blah > > $password: blah > > $database: _ Just the name of the database. > > $link=mysql_connect($hostname, $user, $pass) or die("Failure to > > communicate with database"); > > > > $close=mysql_select_db($database, $link); > > > > > > > > All I get is the "Failure to communicate." message. > > > > Server #1: ellerweb.eller.arizona.edu > > Server #2: datamonster.sbs.arizona.edu > > $database is cassy, but do I need to add anything to that? The obvious question is: does server #2 ALLOW remote connections from server #1? If so does it work if you connect using the mysql command line? -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* It's not so hard to lift yourself by your bootstraps once you're off the ground. -- Daniel B. Luten */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Connecting to DB on separate server?
Cassy M Rowe wrote: I have a php page on server #1 trying to access a database on server #2. What do I put in the following blanks: $hostname: ___ (have tried IP, http, localhost, nothing works) $username: blah $password: blah $database: _ $link=mysql_connect($hostname, $user, $pass) or die("Failure to communicate with database"); $close=mysql_select_db($database, $link); All I get is the "Failure to communicate." message. Server #1: ellerweb.eller.arizona.edu Server #2: datamonster.sbs.arizona.edu $database is cassy, but do I need to add anything to that? I've tried asking two people who are really good at this and they have no answers. THANK YOU IN ADVANCE! Cassy Rowe Maybe you have to specify the port of the database on the remote machine. Maybe the MySQL daemon is not running? -- From Mozilla and GNU/Linux -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php