PHP executes an external name to obtain error information

Source: Internet
Author: User
Php provides four methods to execute External commands. The external commands can be a system command or a self-implemented shell (Linux) and batch processing (window) script. The four call methods are exec (), passthru (), system (), and shell_exec (). For their differences, see www.leapsoul.cn? P646. This article describes

Php provides four methods to execute External commands. The external commands can be a system command or a self-implemented shell (Linux) and batch processing (window) script. The four call methods are exec (), passthru (), system (), and shell_exec (). For the differences between them, see: http://www.leapsoul.cn /? P = 646. This article describes

Php provides four methods to execute External commands. The external commands can be a system command or a self-implemented shell (Linux) and batch processing (window) script. The four call methods are exec (), passthru (), system (), and shell_exec (). For the differences between them, see: http://www.leapsoul.cn /? P = 646.

This document describes how to obtain command error information in linux. Errors include command execution errors and name spelling errors. The above four methods only return the command execution return code without specific error information. To obtain specific error information, you can output the output result of command execution to a file. Use the symbol ">. For example:

$ Cmd = 'your command>/tmp/test. log 2> & 1'; exec ($ cmd );

Command output information can be found in/tmp/test. log.

Original article address: PHP executes an external name to get error information. Thank you for sharing it with the original author.

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.