PHP多线程

PHP code
$filename=dirname(dirname(__FILE__)).'./log/getreport.log';
$handle=fopen($filename,"a+");
while(!feof($handle)){$update_history=fgets($handle);}
if($update_history==NULL or $update_history==''){$update_history=date("Y-m-d",strtotime("-1 day"));}
$day=datediff('d',$update_history,date("Y-m-d"),false);
if($day>0){
    if($filename==''){$filename=dirname(dirname(__FILE__)).'./log/getreport.log';}
    file_put_contents($filename,date("Y-m-d"));
    $fp = fsockopen('localhost',80,$errno,$errmsg);
    fputs($fp, "GET /inc/cron.php\r\n\r\n");
    fclose($fp);
}


以上程序在本地测试时可以实现多线程,在不影响index.php运行的情况下,在服务器端就完成了cron.php,但是将程序上传到服务器后,发现cron.php根本就不运行了,这是怎么回事?怎么才能解决?

作者: neegame   发布时间: 2011-05-27

也想学习一下

作者: albaba1903   发布时间: 2011-05-27

尝试注释掉 fclose($fp);

作者: xuzuning   发布时间: 2011-05-27

引用 2 楼 xuzuning 的回复:
尝试注释掉 fclose($fp);


还是不运行。

作者: neegame   发布时间: 2011-05-27