Why does PHP execute a shell return value of 1?

Source: Internet
Author: User
Tags parse error
$cmd = system("wget http://la-lg.hostus.us/500MB.test",$r);echo $r;

?>

Can be executed successfully, but the printed value is 1, according to reason, Normal is not 1? There's nothing else but mistakes.

Reply content:

$cmd = system("wget http://la-lg.hostus.us/500MB.test",$r);echo $r;

?>

Can be executed successfully, but the printed value is 1, according to reason, Normal is not 1? There's nothing else but mistakes.

Let's look at the official documentation:

Success returns the last line of the command output, and FALSE if it fails

And look at the English version:

Returns the last line of the command output on success, and FALSE on failure.

In fact, both of these statements are apt to cause ambiguity, and the right understanding should be
Success returns the exit code of the command
That

exit(code)

In the code .
In most cases, the exit(0) representative has no errors. However, this does not mean all.
Specific needs under the corresponding commandman wget
Here are the results:

EXIT STATUS       Wget may return one of several error codes if it encounters problems.       0   No problems occurred.       1   Generic error code.       2   Parse error---for instance, when parsing command-line options, the .wgetrc or .netrc...       3   File I/O error.       4   Network failure.       5   SSL verification failure.       6   Username/password authentication failure.       7   Protocol errors.       8   Server issued an error response.       With the exceptions of 0 and 1, the lower-numbered exit codes take precedence over higher-numbered ones, when       multiple types of errors are encountered.

So equals 0 does represent success, and equals 1 represents an error.
Did you download the file successfully?

1 What does that mean?

500M file? It's timed out.

  • Related Article

    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.