1

I hosted my site on web (using cpanel) and another part of my site is on localhost of my desktop.

What I want is when admin updates the data using web that has been updated on my localhost database. For that I want to access database of my desktop.

Here is my code so far:

$MasterHost="MY_IP";
$MasterDatabase="db_my_databse_name";
mysql_connect($MasterHost,"root","");
mysql_select_db($MasterDatabase);

When I run the page from web, I am getting the warning like below:

Warning: mysql_connect(): Can't connect to MySQL server on '59.88.162.240' (4) in /home/new12861/public_html/dekhnelab/dbUnique.php on line 4

Please chech db

Community
  • 1
  • 1
  • What you are trying to do is not good but to make it work you probably need to open a port on your home router or setup port forwarding to the correct machine. I don't recommend this however. – Rob Sep 12 '15 at 07:33
  • As @Rob stated - you would need to create a dmz on your router that allows external traffic through to your machine at home - there are serious risks involved with this – Professor Abronsius Sep 12 '15 at 07:39
  • @ Rob: I am using curl to avoid this but I am getting curl conection timeout error may be because my ip not allowing the access from web – user3759358 Sep 12 '15 at 07:41
  • Your router should be acting as a basic firewall - you do not wanted unsolicited traffic hitting your home network do you? If there are no open ports on the router then traffic isn't going to get through - curl or not. As stated, you need to open a port on the router and apply port forwarding. Have a look at the logs in the router - you will likely see lots of dropped requests – Professor Abronsius Sep 12 '15 at 07:57

0 Answers0