dqdjfb2325 2016-10-18 10:22
浏览 98

运行Google网站搜索时出现500内部服务器错误

This is a first time we are using GSS and applying in our application.

If we search a query in GSS we are getting good result depending upon the websites we have added to be searched from. But if we give GSS around a hundred queries one by one in a for loop, like,

   for ($i = 0, $count = count($arr1); $i < $count; $i++) 
   {
   print $arr1[$i]."

";
  sleep(5);

  $in = $arr1[$i];
  $in = str_replace(' ','+',$in); // space is a +
 //google site search start here

$result = httpGet("https://www.google.com/cse?cx=003255331468891731323:xyxyxyxyxyyx&client=google-csbe&output=xml_no_dtd&q='$in'");

echo $result;
}

Here we have a long string of few pages which we have broken it into small arrays of say 30 words each. These array we have passed in a FOR loop, to get the result (various links) , we have printed the result with echo. We have also applied Sleep of 5 sec so that server gets time to get the result and print it , wait for 5 seconds before searching another query.

But when we are running this for loop, we are not getting result , rather our application hangs, and gives us the result as below:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@checkforplag.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

error screenshot

Kindly suggest what all do we need to do to apply GSS completely in our application.

Thank You!

  • 写回答

1条回答 默认 最新

  • duanji8887 2016-12-17 08:04
    关注

    I got solution for that by sending my php script in background process, and for that i used shell_exec.

    This is the code i used:

    $status = shell_exec("nohup /usr/bin/php test.php > /dev/null 2>&1 &");
    

    And now i am not getting this kind of error even i am running a large file.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度