An error occurs in a shell result of phpexec () because grep in php can only process text streams, but binary streams cannot. Cataa.txt | grepstartup | wc-l in linux command line test no problem. But the exec in php has a problem, which is strange. Result: cat: writeerro cat aa.txt | grep 'startup' | wc-l
Test in linux command line. But the exec in php has a problem, which is strange.
Error:
The error message is cat: write error: Broken pipe.
I spent a lot of effort, checked a lot of information, and finally solved the problem.
-A option is added to the grep option.
The grep-a option indicates Process a binary file as if it were text; this is equivalent to the -- binary-files = text option
It should be cat. The file contains a binary stream, which causes grep to not recognize it.
Http://www.bkjia.com/PHPjc/477649.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/477649.htmlTechArticlecat aa.txt | grep startup | wc-l in linux command line test no problem. But the exec in php has a problem, which is strange. Result: the following error message is displayed: cat: write erro...