sillysillysilly Posted September 21, 2009 Share Posted September 21, 2009 I would like to run a script on one server to access the mysql database on another server (both I own). For example I want to run a script on my laptop that will read data from the mysql database on my home computer running apache 2.2 I am using dyndns to ensure I am always able to get to the computer. I have gone to the www.mypage.org and can run the scripts on that site (my computer) but the scripts on that computer are set for localhost as the domain. When I set the config up on my computer I use define("DB_SERVER", "localhost"); define("DB_USER", "fakeusername"); define("DB_PASS", "fakepassword"); define("DB_NAME", "fakedatabase"); When I set up the laptop I use: define("DB_SERVER", "mypage.org"); define("DB_USER", "fakeusername"); define("DB_PASS", "fakepassword"); define("DB_NAME", "fakedatabase"); Is there something different I need to do in the PHP, the Mysql or the apachie? Quote Link to comment https://forums.phpfreaks.com/topic/175037-solved-php-mysql-question-on-cross-server-support/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 21, 2009 Share Posted September 21, 2009 If you can reach the web server from a remote location, you should probably be able to reach the mysql server from a remote location. Try the following (assuming you are using the default port number for you mysql server) - define("DB_SERVER", "mypage.org:3306"); Quote Link to comment https://forums.phpfreaks.com/topic/175037-solved-php-mysql-question-on-cross-server-support/#findComment-922491 Share on other sites More sharing options...
sillysillysilly Posted September 21, 2009 Author Share Posted September 21, 2009 I tried that but still get the same error. Do I need to set up a virtual server on my apache? Right now I just have the basic install, then have dyndns sent requests directed to my current IP. sorry, I"m a bit of a newb to this stuff, but I appreciate all the help you guys give. Quote Link to comment https://forums.phpfreaks.com/topic/175037-solved-php-mysql-question-on-cross-server-support/#findComment-922508 Share on other sites More sharing options...
01hanstu Posted September 21, 2009 Share Posted September 21, 2009 Hi, Could you try to put the servers IP in the config file? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/175037-solved-php-mysql-question-on-cross-server-support/#findComment-922516 Share on other sites More sharing options...
PFMaBiSmAd Posted September 21, 2009 Share Posted September 21, 2009 I tried that but still get the same error. Until you post the error, no one can help you with what the problem is. xxxxxx out any sensitive information in the error message, but you have got to provide the relative information you know about the problem. There are at least a dozen different things that could prevent a remote connection from working. Quote Link to comment https://forums.phpfreaks.com/topic/175037-solved-php-mysql-question-on-cross-server-support/#findComment-922517 Share on other sites More sharing options...
sillysillysilly Posted September 21, 2009 Author Share Posted September 21, 2009 The error I get is; Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'xxxxxx.org' (10061) in C:\xampp\htdocs\cows\cowboy.php on line 6 Can't connect to MySQL server on 'xxxxx.org' (10061) Quote Link to comment https://forums.phpfreaks.com/topic/175037-solved-php-mysql-question-on-cross-server-support/#findComment-922523 Share on other sites More sharing options...
01hanstu Posted September 21, 2009 Share Posted September 21, 2009 Hi, There error code indicates that the network connection has been refused. You should check that there is a MySQL server running, that it has network connections enabled, and that the network port you specified is the one configured on the server. Also check the firewall. Thanks Stu Quote Link to comment https://forums.phpfreaks.com/topic/175037-solved-php-mysql-question-on-cross-server-support/#findComment-922527 Share on other sites More sharing options...
sillysillysilly Posted September 21, 2009 Author Share Posted September 21, 2009 Mysql is definitely running, I have the firewall turned off, I'm not sure how to re-config the port; I would think the default setup would be ok. Quote Link to comment https://forums.phpfreaks.com/topic/175037-solved-php-mysql-question-on-cross-server-support/#findComment-922536 Share on other sites More sharing options...
sillysillysilly Posted September 21, 2009 Author Share Posted September 21, 2009 I think I am getting closer; I found some info that tells me I have to config mysql to allow tcp/ip I tried it but it caused scripts that were running before to crash; I think however this is because I have those looking to localhost since they are on the local host. I might try hardcoding those systems to the server name and see how that goes. Quote Link to comment https://forums.phpfreaks.com/topic/175037-solved-php-mysql-question-on-cross-server-support/#findComment-922560 Share on other sites More sharing options...
01hanstu Posted September 22, 2009 Share Posted September 22, 2009 Hi, I might try hardcoding those systems to the server name and see how that goes. Do you have the pages on more than 1 pc or are the stored on 1 server and the computer looks at the server for the the pages?? Thanks Stuart Quote Link to comment https://forums.phpfreaks.com/topic/175037-solved-php-mysql-question-on-cross-server-support/#findComment-923101 Share on other sites More sharing options...
PFMaBiSmAd Posted September 22, 2009 Share Posted September 22, 2009 The OP started a new thread for this same subject - http://www.phpfreaks.com/forums/index.php/topic,270054.0.html Quote Link to comment https://forums.phpfreaks.com/topic/175037-solved-php-mysql-question-on-cross-server-support/#findComment-923110 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.