Different output with php client and with a browser
Maybe my question is simple, but I'm not able to answer it.
I have this开发者_Python百科 little php code:
<?php
$line="echo 'hello' | lpr -Pmyprinter";
$out=system($line,$output);
?>
When I execute this code using my command line (I use linux with php 5.3.6 and apache 2.2.17) it's printed 'hello' in myprinter.
If I execute this code using my browser it looks like the pipe is ignored!
I have tried with exec(), passthru(), etc. and results are the same.
Thanks for your help.
P.S: I ran previously this code with PHP 5.1.¿¿??
Try using the following:
echo `echo hello | lpr -Pmyprinter`
精彩评论