PHP system commands perform inconsistent results on Web pages and command lines
Hello everyone, now I have a file a.php. Content is:
PHP Code
When I execute with http://192.168.1.1/a.php, the results show:
HTML Code
When I execute with/usr/local/php a.php at the command line, the results show:
HTML Code
Building target platforms:i686--linuxbuilding for target i686--linuxprocessing files: Vtcual06.06c.p010-r1.0-p1finding provides: (Using/opt/rpm/lib/rpm/find-provides) ... Finding Requires: (using/opt/rpm/lib/rpm/find-requires) ... wrote:/export/home/webadm/.rpm/rpms/i686/vtcua
This means that there are three lines in the HTTP access mode that are not displayed:
HTML Code
Finding provides: (Using/opt/rpm/lib/rpm/find-provides) ... Finding Requires: (using/opt/rpm/lib/rpm/find-requires) ... wrote:/export/home/webadm/.rpm/rpms/i686/vtcua
Does anyone know what the reason is? Thank you!!
------Solution--------------------
This question is so strange ~ ~ ~
Does anyone know about the cows?
------Solution--------------------
Not surprisingly, the execution user is different. The command line executes root, and the Web page executes the Apache user.
Google a bit, said Apache with--enable-suexec compiled can, but did not try.
------Solution--------------------
discuss
Not surprisingly, the execution user is different. The command line executes root, and the Web page executes the Apache user.
Google a bit, said Apache with--enable-suexec compiled can, but did not try.
------Solution--------------------
discuss
It was always possible to do that before. I just can't do it suddenly. So it should be with the user.
------Solution--------------------
This is not possible.
------Solution--------------------
Look at the results of executing your program in PHP command-line mode
------Solution--------------------
Oh, I didn't notice.
This is obviously a matter of permission.
Web-mode PHP is just anonymous users, with only the lowest permissions
In other words, if everything can be manipulated by the browser, then there is no security in the system.
Think of Microsoft in order to provide convenient data query, to mssql2000 add a URL query function
It turned out to be a notorious SQL attack without being exploited.
------Solution--------------------
All said is the authority problem, you add sudo no, how the result?
------Solution--------------------
There should be, if not you wget download install one.
------Solution--------------------
No output at the back. I suspect there may be a mistake, you try the code and tell me the result.
function My_exec ($cmd, $input = ")
{$proc =proc_open ($cmd, Array (0=>array (' Pipe ', ' r '), 1=>array (' Pipe ', ' w '), 2=>array (' Pipe ', ' w '), $pipes);
Fwrite ($pipes [0], $input); fclose ($pipes [0]);
$stdout =stream_get_contents ($pipes [1]); fclose ($pipes [1]);
$stderr =stream_get_contents ($pipes [2]); Fclose ($pipes [2]);
$rtn =proc_close ($PROC);
Return array (' stdout ' = $stdout,
' stderr ' = $stderr,
' Return ' = $rtn
);
}
$str = "/opt/rpm/bin/rpm-bb--target i686--linux/tmp/test.spec";
Var_export (My_exec ($STR));
------Solution--------------------