View Full Version : file_get_contents question

DJ Hands3
05-29-2011, 09:02 PM
I rely on file get contents like this
file_get_contents('http://www.externalsite.co.uk/search1.php?q='.$file_name); and it will retreive all split winrar parts to download for the file passed from the query and this is from another external site I run where the files are stored.

The above is run 5 times per page, but since yesterday the page stopped downloading and just hangs, so I limited the pagination to show 1 file per page so will only call file get contents once per page this solved the problem so the webpage would load.

I'm sure it's the server on my external site that has somehow slowed down, and there for freezes the page trying to get the contents. On the other side of things I doubt it but the shared server file get contents runs on maybe they have reduced my php memory limit, but I googled a bit on this and from what I have found it doesn't use much memory?

I thought I would just ask the before I raise a support ticket

05-30-2011, 06:11 AM
As code does not often change itself on its own, usually it's a good bet that something external has happened if you haven't modified your code in any way that would cause it to stop working.

When I see this, and also see you're on a shared host, I immediately think that the hosting company many have throttled you in some way. Most web hosts very much frown on file hosting websites, typically because it costs them more money to host.

Your easiest bet is to submit that ticket and see if your host has changed anything on their end. If that doesn't pan out, check to make sure any changes you've made didn't have unintended effects. This will be in any server settings, control panel settings, PHP.INI, or httpd.conf.

Unfortunately with ambiguous problems like this we can't really give you a "Go here and change this" fix. Best to retrace your steps and debug in that way.