The PHP system command performs inconsistent results on the Web page and on the command line

Source: Internet
Author: User
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--------------------
  • 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.