0

I'm having a problem where the php function file_get_contents causes segmentation fault (11) error.

This problem started when many of my php scripts suddenly started causing browser errors like "ERR_EMPTY_RESPONSE", etc. So i tried finding out what all those files had in common. And then found out that loads json data from external servers via the file_get_contents function. I tried removing that function from one of the files. And sure enough. The script suddenly works (but not loading the data. Obviously.) All of these scripts loads content from different urls from different servers from different companies. So i already know that it's not any specific url or file.

Here's a sample from my apache error log:

[Thu Jul 30 16:43:58.890237 2015] [core:notice] [pid 2833] AH00052: child pid 4729 exit signal Segmentation fault (11)

I've been searching around for hours. Trying to find solutions, workarounds, alternative functions, etc. But with no luck. The only solution i found was to change php mode to "fast-cgi". Which i don't want after reading that fastcgi will not let me serve page rules via .htaccess anymore. (Half of my sites runs of rules defined in .htaccess files).

Does anyone have any idea why this is happening? And how to fix it? I may also note down that i never did anything to cause this. I never changed anything in any configurations or anything. It simply just started happening a couple of days ago. So there must be some way to fix this error right? Thanks in advance!

0

Try using an other method to get the file content. As suggested by a user here who seems to have the same problem:

http://kb.odin.com/en/125759

function get_content($URL){
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($ch, CURLOPT_URL, $URL);
   $data = curl_exec($ch);
   curl_close($ch);
   return $data;
}

$filecontent = get_content("URL");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.