Execute the exec solution for PHP in Linux

Source: Internet
Author: User
The code for executing execPHP in Linux is 5.4PHP: & lt ;? Phpexec (whoami, & nbsp; $ r); var_dump ($ r); the root user uses php & nbsp; test on the server terminal. the php output result is as follows, which is correct [[email & #160; protected] & nbsp; htdocs] # & nbsp; php & nbsp; test. PHP executes exec in Linux
PHP 5.4

The PHP code is as follows:

Exec ('whoam', $ r );
Var_dump ($ r );


Root users use php test. php on the server terminal
The output result is as follows, which is correct.

[[Email protected] htdocs] # php test. php
Array (1 ){
[0] =>
String (4) "root"
}


But enter the http://192.168.x.x/test.php in the browser
The output is empty.

I feel that it is a permission issue on the linux server, but I don't know which permission issue.
The user name for running httpd is apache.
------ Solution --------------------
Whoami display login name
The viewer accesses the website anonymously (that is, without a name), so it is correct to display it as null.

------ Solution --------------------
Output the error and you will know if the permission is incorrect.

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.