Home  >  Article  >  Backend Development  >  Parsing how to directly execute SHELL_PHP tutorial in php

Parsing how to directly execute SHELL_PHP tutorial in php

WBOY
WBOYOriginal
2016-07-21 15:02:11738browse

$message=shell_exec("sudo /usr/local/webserver/nginx/sbin/nginx -t 2>&1");
echo "Run result:".$message."
";

The above statement can directly execute the SHELL statement in PHP

If there is a return value, then 2>&1 is required He will redirect the output strerr to strout output!

Otherwise the return result will be empty!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327946.htmlTechArticle$message=shell_exec("sudo /usr/local/webserver/nginx/sbin/nginx -t 2 echo " Running result: ".$message."br/"; The above statement can be directly executed in PHP. If there is a return value, then...
Statement:
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