here $pipes[1] is empty. the process takes around 3 seconds to execute. i guess that is the reason for the problem. I tried running a simple 'echo foo' as cmd and it is running fine. but for this pos tagger command m facing this problem....
i suggest you to run the code in windows to better understand the problem...
$descriptorspec = array( 0 => array("pipe", "r"), // stdin 1 => array("pipe", "w"), // stdout 2 => array("pipe","w") // stderr );
$process = proc_open($cmd, $descriptorspec, $pipes, dirname($this->getjar())); //$cmd is java -mx300m -cp ^"postagger^\stanford-postagger.jar^;^" edu.stanford.nlp.tagger.maxent.MaxentTagger -model C:^\wamp^\www^\yii^\basic^\views^\site^\postagger^\models^\english-left3words-distsim.tagger -textFile C:^\Windows^\Temp^\pos1D8A.tmp -outputFormat slashTags -tagSeparator ^#^# -encoding utf8//
if(is_resource($process)) { // ignore stdin - input fclose($pipes[0]); echo stream_get_contents($pipes[1]); // get stdout - output $output = stream_get_contents($pipes[1]); fclose($pipes[1]); // get stderr - errors $errors = stream_get_contents($pipes[2]); fclose($pipes[2]);}
here $pipes[1] is empty. the process takes around 3 seconds to execute. i guess that is the reason for the problem. I tried running a simple 'echo foo' as cmd and it is running fine. but for this pos tagger command m facing this problem....
i suggest you to run the code in windows to better understand the problem...