PHP fopen timeout?
any idea why fopen will timeout for a file if it's on my server and i know the url is correct?
update: sorry, I should have mentioned this in php. the code:
fopen($url, 'r');
It works if I put a relative path for the file, but not if $ url is the url on my server (but it works for google.com). Thanks for the help.
The answer to Alaytnik's question was right. The problem only occurs when accessing my own server files over ethernet interface. How can I fix this? I need to be able to access the file from the ethernet interface because the url is loaded dynamically (it is generated from wordpress cms, so the url does not technically exist as a file on my server)You seem to be trying to download a file from your own server using the HTTP protocol from a program running on the same server?
If so, the timeout issue is likely related to your webserver or network setup. Waiting times usually only happen because:
- the server does take a long time to send a response, or
- blocked TCP connection
For example, it could be that your local firewall rules only allow access www.example.com
if those requests are coming from the ethernet interface, but the local connection will try to go through the loopback interface.
a source to share