mailjol Posted January 20, 2007 Share Posted January 20, 2007 Well I am running a PHP program through CLI. I want the most resource efficient and fast way for the data that has been passed to it on STDIN to get redirected to some other PHP script started through exec, system, popen etc and the calling script to exit immediately. For example when all text inside data.txt is passed to script1.php:cat data.txt | ./script1.phpThe stream php://stdin contains this data. I want script1.php to start script2.php, pass the data of php://stdin to script2.php and exit. Script2.php will take some time to exit as it will deal with the data so I don't want script1.php to wait.BTW I am using PHP 4.4.0 so I don't have access to all those stream functions of PHP 5.Regards,Akash Link to comment https://forums.phpfreaks.com/topic/34952-smartest-way-to-redirect-stream-phpstdin/ Share on other sites More sharing options...
printf Posted January 20, 2007 Share Posted January 20, 2007 In order to do that, you have to close STDIN, STDOUT, STDERR. Seeing your using PHP 4, the best way to do that will depend on the system, because PHP 4 doesn't have any native way to do this. So the only way to attack this is using a system process with PHP, depending on the system will tell me which way is best. So what OS is PHP running on!printf Link to comment https://forums.phpfreaks.com/topic/34952-smartest-way-to-redirect-stream-phpstdin/#findComment-164831 Share on other sites More sharing options...
mailjol Posted January 20, 2007 Author Share Posted January 20, 2007 Debian (Linux) Link to comment https://forums.phpfreaks.com/topic/34952-smartest-way-to-redirect-stream-phpstdin/#findComment-164837 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.