Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP/MySQL Connection Problem

Status
Not open for further replies.

cmhunt

Programmer
Apr 17, 2001
119
GB
Hi

I am running PHP on one machine and want to query a MySQL database on another machine at another site using mysql_connect(). Without our firewall on, the PHP runs fine but with the firewall on, I get a "Can't connect..." error.

The problem is that I need to know which specific port this is using as we can't afford to leave the firewall off.

Thanks in advance for any help.

Chris
 
Sorry, I should have mentioned that we have tried that. Not really knowing too much about this sort of thing, isn't that the port that I am connecting to on the machine that's running MySQL? Is that the same one that would be used on the machine running the PHP??

Chris
 
Yes, same port number. Mine is 3306 too. Have a look in my.ini located in the windows folder (on MS systems only, of course).

Good Luck §;O)


Jakob
 
try this to connect:

$username="username";
$password="password";
$database="your_database";

mysql_connect("localhost","username","password");
@mysql_select_db("database") or die( "Unable to select database");
 
Thanks to everyone for their help. Not sure why but the first time we tried to unblock that port, it still didn't work. During further testing it seemed to work fine - strange!! While I'm here, I should also point out to anyone else who follows this problem with an "Access Denied" error as I was after adding a new user, that they should flush privileges in MySQL. All worked fine then!!

Thanks

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top