PHP exec () A shell result error because grep in PHP only handles text flow, binary stream not _php tutorial

Source: Internet
Author: User
Cat Aa.txt | grep ' startup ' |wc-l is not a problem to test under the Linux command line. But there's a problem with the exec in PHP, it's weird. Result Error: Error prompt as follows: Cat:write Error:broken pipe waste a good big strength, check a lot of information, finally solved. The option to add the-a option to grep is OK with the grep-a option meaning: Process a binary file as if it were text; This was equivalent to the--binary-files=text option should be cat's this file content has a binary stream that causes grep to not recognize

http://www.bkjia.com/PHPjc/477649.html www.bkjia.com true http://www.bkjia.com/PHPjc/477649.html techarticle Cat Aa.txt | grep startup |wc-l There is no problem testing under the Linux command line. But there's a problem with the exec in PHP, it's weird. Result Error: Error prompt as follows: 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.