Search code examples
phprestpearhttp-request

HTTP_Request call works in browser, timeout in web app


I have a web application which gets data from itself via a REST API in JSON format. I am in the process of moving this site to a new server on a new host. I have everything moved, same database, same files. The main differences would be that PHP is running as a module on the new server instead of FastCGI and the new host has a client-configurable-firewall.

The web app makes the API call by using Pear's HTTP_Request object (GET method). When I run the web app that makes the call, it spins until it finally returns a "Connection timed out" error.

However, if I echo the URL being used by the call and then hit that directly in my browser it returns all the JSON data instantly.

I am wondering if this could be a firewall issue: port or protocol used by the guts of Pear's HTTP_Request object blocked? (There is currently a firewall policy allowing traffic on port 80 from any IP).

Or a permission issue: PHP running as a module is more sensitive to this.

Any ideas would be greatly appreciated!


Solution

  • As the new server is still only being tested using the IP address, the internal web application was attempting to access itself via an external IP. From the server itself, the external IP is not available. It has to be changed to point to the internal network IP for testing.

    Once the domain name is moved this will become a non-issue again.