PHP execution Shell does not block method shell if Royal Dutch Shell group ADB shell

Source: Internet
Author: User
We all know that PHP executes system commands in the following ways:
System () outputs and returns the last line of the shell results.
EXEC () does not output results, returns the last line of the shell result, and all results can be saved to a returned array.
PassThru () only invokes the command and outputs the result of the command directly to the standard output device.

These methods will wait for the command to complete before proceeding with the subsequent program execution.
Do not block the contents of the command output can be written to a recycle Bin file on the system so that the program does not block
For example:

shell_exec("/use/local/php/bin/php /www/t.php  > /dev/null 2>&1 &");

The shell can often be seen: >/dev/null 2>&1

The result of the command can be defined in the form of a%> output

/dev/null represents an empty device file

Delegate redirect to where, for example: echo "123" >/home/123.txt
1 means stdout standard output, the system default is 1, so ">/dev/null" is equivalent to "1>/dev/null"
2 indicates stderr standard error
& means equivalent to, 2>&1, 2 output redirect equals 1

Then the statement in the title of this article:
1>/dev/null first indicates that the standard output is redirected to an empty device file, that is, not outputting any information to the terminal, which is plainly not displaying any information.
2>&1 then, the standard error output redirection is equivalent to the standard output because the standard error output is redirected to the empty device file because the standard output was previously redirected to an empty device file.

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the PHP execution shell non-blocking method, including the shell aspects of the content, I hope the PHP tutorial interested in a friend helpful.

  • 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.