我有一個PHP腳本「A」,啓動另一個PHP腳本「B」,最長運行5個小時。我使用curl函數。但我的問題是,腳本「A」不能確定與腳本「B」的連接。我改變了max_execution_time,timeout,socket-timeout等等,但沒有任何幫助。連接保持活動問題
我是否需要使用curl或類似的東西將腳本發送到腳本「B」?
$curl_header[] = "Accept: text/xml,application/xml,application/xhtml+xml,text
/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$curl_header[] = "Cache-Control: max-age=0";
$curl_header[] = "Connection: keep-alive";
$curl_header[] = "Keep-Alive: 84600";
$url = 'http://test.de/test_B.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_header);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
curl_setopt($ch, CURLOPT_TIMEOUT, 84600);
curl_setopt($ch, CURLOPT_NOSIGNAL, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
$curl_errno = curl_errno($ch);
curl_close($ch);
`
粘貼一些代碼? – GBD
調用php腳本本身是否超時?您是否將調用scipt的max_execution時間設置爲0?您是否也設置了低傳輸速率 - 如果您獲得了部分響應(包括空白),然後什麼都不做,CURLOPT_LOW_SPEED_TIME可能會啓動嗎? – Robbie