Jump to content


Photo

Cannot connect to remote MySQL system from within PHP.


  • Please log in to reply
1 reply to this topic

#1 bag

bag
  • New Members
  • Pip
  • Newbie
  • 9 posts
  • LocationUK

Posted 12 January 2003 - 02:50 AM

Hi,

I have two NT 4 servers running on my home network, both have Apache installed, one \'asia\' has MySQL 3.23.49-max-nt-log, installed. I can connect from my main system \'echo\' to MySQL using a command window to connect via ODBC all set up several months ago via instructions in a book. All working OK (As I can see). I just lately discovered PHP and decided to add that to my Intranet to allow access to real data. To this end I updated all versions to the latest, Apache 2.0.43, and on the other server, \'isis\', I installed PHP 4.3.0. The Apache, PHP combination works OK.

The problem is when I come to connect to the remote DB I get nothing. It fails every time with no error message at all. I connected using the nodename \'asia\' with no joy so I tried the IP address.
$connection= mysql_connect(\"192.168.0.1\",\"sqlaccess\",\"password\");
It must connect and be rejected but I get no error nor a connection. If I try an invalid IP I get a long delay before a failure with no message again!!!.

It must be something simply because it\'s driving me loopy. Any ideas on where to look would be appreciated.

#2 bag

bag
  • New Members
  • Pip
  • Newbie
  • 9 posts
  • LocationUK

Posted 18 January 2003 - 04:44 AM

:D It was suggested I add a mysql_error() into my die statement which I didn\'t know you could do. I was calling it later when it had obviously been flushed. Anyway, it told me there was a password error which I played about with until it clicked. It was accessing the MySQL server from the other node \'isis\' not my client \'echo\' and I had different passwords on access for each. Changed the password in the connection statement to the one for \'isis\' and away it went.

Simple but still a pain.

Anyway sorted now. :D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users