An error occurred in a shell result of phpexec () because grep in php can only process text streams, but binary streams cannot be used. _ PHP Tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.