accessing a backgrounded applications stdin/stdout with php -


i want php execute unix application in background, , have access stdin/stdout similar how subprocess can in python ...is possible? if how?

you can exectute external program http://php.net/manual/en/function.exec.php

you can execture apart of php's cli interface 3 "streams" can interact in more or less same way file resource returned fopen(). streams identified strings:

php://stdin (read) php://stdout (write) php://stderr (write)

with php 4.3.0+ cli binary, these 3 streams automatically available, identified constants stdin, stdout , stderr respectively. here's how can use stdout fix above script behaves correctly on windows:

<?php $i = 0; while ( $i < 10 ) {    // write output    fwrite(stdout, $i."\n");    sleep(1);    $i++; } ?> 

http://articles.sitepoint.com/article/php-command-line-1

pk


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -