我已經寫了一個腳本來批處理域並檢索每個域上的數據。對於檢索的每個域,它通過curl連接到遠程頁面,並一次檢索30個域所需的數據。Mysql Server在PHP腳本上消失了錯誤
這個頁面通常需要2-3分鐘才能加載並返回curl結果,此時,細節被解析並放入一個數組(頁面排名工具函數)中。
通過CRON運行此腳本時,我不斷收到錯誤'MySQL服務器已經消失'。
任何人都可以告訴我,如果我錯過了可能導致此事的明顯事物嗎?
// script dies after 4 mins in time for next cron to start
set_time_limit(240);
include('../include_prehead.php');
$sql = "SELECT id, url FROM domains WHERE (provider_id = 9 OR provider_id = 10) AND google_page_rank IS NULL LIMIT 30";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
do {
$url_list[$row['id']] = $row['url'];
} while ($row = mysql_fetch_assoc($result));
// curl domain information page - typically takes about 3 minutes
$pr = page_rank_tools($url_list);
foreach ($pr AS $p) {
// each domain
if (isset($p['google_page_rank']) && isset($p['alexa_rank']) && isset($p['links_in_yahoo']) && isset($p['links_in_google'])) {
$sql = "UPDATE domains SET google_page_rank = '".$p['google_page_rank']."' , alexa_rank = '".$p['alexa_rank']."' , links_in_yahoo = '".$p['links_in_yahoo']."' , links_in_google = '".$p['links_in_google']."' WHERE id = '".$p['id']."'";
mysql_query($sql) or die(mysql_error());
}
}
感謝
CJ
通常,這只是服務器超時 – 2011-01-21 08:45:21