使用XMLReader()的内部服务器错误500

时间:2019-03-03 10:38:27

标签: php xml xmlreader

我遇到一个奇怪的问题...我正在使用XMLReader()从远程服务器打开大型XML文件并进行解析。在本地服务器上,我可以从远程服务器打开XML文件并成功进行解析。但是在真实服务器上尝试相同操作时,出现此错误Internal Server Error 500. 我尝试使用Curl创建临时文件...

     $xml = new XMLReader();

     $temp_file = tempnam(sys_get_temp_dir(), 'Temp_XML');

     $fp = fopen($temp_file, 'w+');
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_FILE, $fp);
     curl_exec($ch);
     curl_close($ch);
     fclose($fp);
     $xml->open($temp_file); 

但是没有成功,同样的错误。 为什么会这样?
1。已编辑 [fastcgi:error] [pid 18996:tid 139642498168576] [client xxx.xxx.xxx.xxx:56057] FastCGI: comm with (dynamic) server "/usr/local/fastcgi/cgi-bin/php-cgi" aborted: (first read) idle timeout (300 sec)此错误。我已经尝试使用函数set_time_limit(3600)增加超时时间;但这似乎不起作用。

0 个答案:

没有答案