Home > Backend Development > PHP Tutorial > linux exec and shell_exec function_PHP tutorial

linux exec and shell_exec function_PHP tutorial

WBOY
Release: 2016-07-20 11:09:21
Original
1056 people have browsed it

Popen, passthru, proc_open, shell_exec return The results are as follows:

[root@krlcgcms01 shell]# php test.php 1001.log 10.log 10.tar.gz aaa.tar.gz mytest test1101 test1102 weblog_2 010_09 I can find out These are just a few functions that can execute commands under Linux. I think there should be more. Everyone is welcome to add.

Under normal circumstances, php is rarely used to execute Linux commands, but under special circumstances, you may use these functions. I used to know that there are two functions that can execute linux commands, one is exec and the other is shell_exec. In fact, there are many. Based on the content of the manual, the following 6 functions are introduced.


1. exec function

The return result is as follows:

[root@krlcgcms01 shell]# php ./exec. php array ( [0] => 1001.log [1] => 10.log [2] => 10.tar.gz [3] => aaa.tar.gz [4] => mytest [5] => test1101 [6] => test1102 [7] => weblog_2010_09 )


http://www.bkjia.com/PHPjc/444815.html

truehttp: //www.bkjia.com/PHPjc/444815.htmlTechArticle?php tutorial $test = ls /tmp/test; $out = shell_exec($test); echo $out ; ? The return results of popen, passthru, proc_open, shell_exec are as follows: [root@krlcgcms01 shell]# php test.php 1001.log 1...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template