php - How can I run a long background process in Zend Framework -


i'm trying run background process when user sends form action, , tell him process started , in ten minutes data updated. have troubles. in action looks this:

public function actualizarlineasaction()     {         $this->view->titulo = $this->_helper->x->lang("actualizar el número de líneas de todos los clientes");         if($this->getrequest()->ispost())         {             if($this->_getparam('start'))             {                 $descriptorspec = array(                     array('pipe', 'r'),                     array('file', 'myfile.txt', 'a'),                     array('pipe', 'w'),                  );                $proc = proc_open("php ".application_path."/../scripts/update_clientes_lineas.php > ".application_path."/../scripts/update_lines.log", $descriptorspec, $pipes);                proc_close($proc);                 $this->view->message = $this->_helper->x->__("el proceso empezó en unos minutos habrá terminado y los contadores de líneas de los clientes estarán actualizados");              }         }     } 

the script file (in script want parse , insert data base large file 12500 lines validations , checks) test, simple script:

<?php  //it test ($index = 1; $index < 1800; $index++) {     $x = $index * 18;     sleep(10); } echo "el resultado ".$x; ?> 

i put script init's, define's , botstrap runs etc.. , same result(now i'm trying without they), this:

x-powered-by: php/4.4.9 content-type: text/html  <br /> <b>parse error</b>:  syntax error, unexpected t_object_operator in <b>/homez.636/innovaco/fenix/public/index.php</b> on line <b>9</b><br /> 

well worried version sever php , in application through htaccess it's sets 5_4 in comand line can't it.

is problem of error? if not, what's going on?

what best way zend framework background process without maintain client waiting response?

i'd appreciate help.

thank much!

greetings.

for background process i'd use exec().

in php manual see notes section , first white note

if program started function, in order continue running in background, output of program must redirected file or output stream. failing cause php hang until execution of program ends.

you can find few examples below in user contributed part.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -