PHP脚本超时-未收到CURL响应

PHP脚本超时-未收到CURL响应,php,curl,Php,Curl,我正在运行一个PHP脚本,其中我使用CURL将一个参数传递给另一个PHP脚本,并调用它100次 现在,第二个函数被成功调用了大约30次,但过了一段时间,我收到了一个超时错误,表示类似“未收到响应” 下面是我用来调用第二个PHP脚本的第一个PHP脚本: <?php $time_start = time(); for($i=0;$i<100;$i++){ $data = array("order_total"=>"test", "enterprise_code"=>2, "

我正在运行一个PHP脚本,其中我使用CURL将一个参数传递给另一个PHP脚本,并调用它100次

现在,第二个函数被成功调用了大约30次,但过了一段时间,我收到了一个超时错误,表示类似“未收到响应”

下面是我用来调用第二个PHP脚本的第一个PHP脚本:

<?php
$time_start = time();

for($i=0;$i<100;$i++){
$data = array("order_total"=>"test", "enterprise_code"=>2, "order_number"=>"2", "origin"=>"2");
$string = http_build_query($data);

$ch=curl_init($undisclosed-path);
curl_setopt($ch, CURLOPT_POST, true); //we are going to use the post method
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); //this $string is going to be posted
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);

curl_exec($ch);

curl_close($ch);
}
?>

在第二个脚本中,我每次都会回显一些东西,所以我认为应该会收到响应。。。但我想没有

有没有办法让PHP脚本有更长的执行时间,这样它就不会像那样超时?或者以某种方式指示它不要期望任何响应?在某些情况下,我得到的是错误500而不是超时


谢谢。

设置时间限制($s)
但是也许你不应该让目标服务器充斥着请求。我添加了设置时间限制(10000);在第一个脚本的第一行,但我仍然得到一个错误500。第二个脚本仍然被成功调用了大约30次。有迹象表明,在我收到错误500后,第二个脚本被调用了几次。我仍然在问,为什么需要向远程服务器发送100个请求。如果是我的服务器,我会阻止你。如果PHP作为CGI(在cURL客户端)运行,Apache可能会在超过
Timeout
的时间内终止请求。这与脚本中设置的PHP时间限制无关。例如或。