I have 2 ethernet eth0 and eth1 on my server. The default gateway is set to be eth0. I need to connect ip 10.10.6.2 using fsockopen in php. The ip 10.10.6.2 is routed through eth1 (I have a rule set on route-eth1). When I try to ping that ip from system I am able to get a response. But when I try to fsockopen that IP from php I am getting timeout error. I have also enabled allow_url_fopen from php.ini
Warning: fsockopen() [function.fsockopen]: unable to connect to 10.10.6.2:5016 (Connection timed out) in /home/xxxxx/public_html/test.php on line 2
Connection timed out (110)
can anyone help me to solve this issue?
check your firewall to allow 10.10.6.2 port 5016 (or any port that you need to connect), you can try telnet from web server telnet 10.10.6.2 5016, to make sure it's able to connect.