Re: Fwd: A fatal error with php virtual cron

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I already wrote that..

ignore_user_abort(true);
set_time_limit(0);
sleep(1);

________________


*
          צור איתי קשר:*  <http://www.facebook.com/profile.php?id=682327963>


On Wed, Mar 25, 2009 at 9:38 PM, Igor Escobar <titiolinkin@xxxxxxxxx> wrote:

> Try the ignore_user_abort(true);
>
> Regards,
> Igor Escobar
> systems analyst & interface designer
> www . igorescobar . com
>
>
>
> On Wed, Mar 25, 2009 at 4:21 PM, אלמוג בקו <almog.baku@xxxxxxxxx> wrote:
>
>> This is a part of the class:
>>
>> private function _request() {
>>     //URL information
>>     $url        = "http://".$_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
>>     $url_info    = parse_url($url);
>>
>>     //Fixing port
>>     if(!isset($url_info['port'])) $url_info['port']=80;
>>
>>
>>     //Send "Cron-data"
>>     $data = array(
>>         'jobs'        => base64_encode(var_export($this->jobs, true)),
>>         'firstRun'    => base64_encode($this->firstRun)
>>     );
>>     $data=http_build_query($data);
>>
>>     //Headers
>>     $headers = ""
>>                 ."POST " . $url . " HTTP/1.0 \r\n"
>>                 ."HOST: " . $url_info['host'] . ":" . $url_info['port'] .
>> " \r\n"
>>                 ."Content-type: application/x-www-form-urlencoded \r\n"
>>                 ."Content-Length: " . strlen($data) . " \r\n"
>>                 ."User-Agent: phpCron \r\n"
>>                 ."Connection: close\r\n\r\n"
>>                 .$data
>>                 ;
>>
>>     //Error vars
>>     $errstr    = null;
>>     $errno     = null;
>>
>>     $fp = fsockopen($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT'],
>> $errno, $errstr, 0.5);
>>     if($fp) {
>>         @fwrite($fp, $headers);
>>         @stream_set_timeout($fp, 0.5);
>>         @stream_set_blocking($fp, 0);
>>         @fclose($fp);
>>         return true;
>>     } else {
>>         $this->error = array('socket'=>array('errstr'=>$errstr,
>> 'errno'=>$errno));
>>         return false;
>>     }
>> }
>>
>> ________________
>>
>>
>> *
>>           צור איתי קשר:*
>> <http://www.facebook.com/profile.php?id=682327963>
>>
>>
>> On Wed, Mar 25, 2009 at 9:17 PM, Igor Escobar <titiolinkin@xxxxxxxxx>wrote:
>>
>>> Maybe your problem are in the way you're calling your program by socket.
>>>
>>> If you show me this part of the code, maybe i can help you.
>>>
>>> Regards,
>>>
>>> Igor Escobar
>>> systems analyst & interface designer
>>> www . igorescobar . com
>>>
>>>
>>>
>>> On Wed, Mar 25, 2009 at 4:01 PM, אלמוג בקו <almog.baku@xxxxxxxxx> wrote:
>>>
>>>> Hello,
>>>> There is some week than I trying to solve a critical error on my
>>>> VirtualCron
>>>> script.
>>>>
>>>> *First of all what is VirtualCron?:*
>>>> Virtual cron is script that`s call(http request) himself and doing the
>>>> "jobs" by the time(like a cron-jobs on linux, but this script build on
>>>> php
>>>> and its make it independent by the Operation System and the access to
>>>> the
>>>> server. [wordpress build something like that too]).
>>>>
>>>> *How my system works?:*
>>>> I have a page(cron.php) and I set this settings:
>>>>
>>>>  ignore_user_abort(true);
>>>>  set_time_limit(0);
>>>>  sleep(1); //setting the base time unit
>>>>
>>>> I call to the script by socket connection with timout of 0.5s and with
>>>> non-blocking mode.
>>>>
>>>> Additionaly I have a log system that save a file with the error when
>>>> they
>>>> happend. andI can "kill" the script by deleting "pid" file.
>>>>
>>>> *Well what`s happend?:*
>>>> The script works well when I tune a job to work more 5min from the
>>>> running
>>>> time.
>>>> But from some reason the script stop to run after some seconds.. and the
>>>> system`s log dosent show any php`s error.
>>>>
>>>> BUT I found this error on my apache`s logs:
>>>> *[Wed Mar 25 10:25:19 2009] [error] [client 67.205.44.109] Premature end
>>>> of
>>>> script headers: cron.php*
>>>>
>>>>
>>>> I hope thats someone know what I have to do..
>>>> Thanks a lot,
>>>> Almog Baku, Israel.
>>>>
>>>> *
>>>> *** My script run on Shared DreamHost, with php5 & apache on linux ***
>>>> *
>>>> ________________
>>>>
>>>>
>>>> *
>>>>          צור איתי קשר:*  <
>>>> http://www.facebook.com/profile.php?id=682327963>
>>>>
>>>
>>>
>>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux