|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-07-01 06:43 UTC] mybugs at 163 dot com
[2012-07-01 09:58 UTC] Sjon at hortensius dot net
[2012-07-01 11:30 UTC] mybugs at 163 dot com
[2012-07-01 13:32 UTC] Sjon at hortensius dot net
[2012-07-02 00:46 UTC] aharvey@php.net
-Status: Open
+Status: Duplicate
[2012-07-02 00:46 UTC] aharvey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 22 14:00:01 2025 UTC |
Description: ------------ php.ini [PATH= "D:/Web/test.com/public"] open_basedir ="D:/Web/test.com/public/" Test script: --------------- <?php echo 'open_basedir:'.ini_get('open_basedir').'<br />'; //D:\WEB\TEST_COM\ $cmd = 'ping qq.com'; echo execute('system',$cmd); echo execute('passthru',$cmd); echo execute('shell_exec',$cmd); echo execute('exec',$cmd); echo execute('popen',$cmd); function execute($type,$cfe) { $data = ''; if ($cfe) { if($type=='system') { @ob_start(); @system($cfe); $data = @ob_get_contents(); @ob_end_clean(); } elseif($type=='passthru') { @ob_start(); @passthru($cfe); $data = @ob_get_contents(); @ob_end_clean(); } elseif($type=='shell_exec') { $data = @shell_exec($cfe); } elseif($type=='exec') { @exec($cfe,$data); $data = join("\n",$data); } elseif($type=='popen') { $f = @popen($cfe,"r"); while(!@feof($f)) { $data .= @fread($f,1024); } @pclose($f); } } return $type.'----------<br />'.$data.'<br />'.$type.'----------<br /><br />'; } ?> Expected result: ---------------- open_basedir:D:\Web\test.com\public\ system---------- system---------- passthru---------- Pinging qq.com [119.147.15.13] with 32 bytes of data: Reply from 119.147.15.13: bytes=32 time=11ms TTL=56 Reply from 119.147.15.13: bytes=32 time=11ms TTL=56 Reply from 119.147.15.13: bytes=32 time=11ms TTL=56 Reply from 119.147.15.13: bytes=32 time=11ms TTL=56 Ping statistics for 119.147.15.13: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 11ms, Maximum = 11ms, Average = 11ms passthru---------- shell_exec---------- Pinging qq.com [119.147.15.17] with 32 bytes of data: Reply from 119.147.15.17: bytes=32 time=9ms TTL=56 Reply from 119.147.15.17: bytes=32 time=9ms TTL=56 Reply from 119.147.15.17: bytes=32 time=9ms TTL=56 Reply from 119.147.15.17: bytes=32 time=9ms TTL=56 Ping statistics for 119.147.15.17: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 9ms, Maximum = 9ms, Average = 9ms shell_exec---------- exec---------- Pinging qq.com [119.147.15.17] with 32 bytes of data: Reply from 119.147.15.17: bytes=32 time=9ms TTL=56 Reply from 119.147.15.17: bytes=32 time=9ms TTL=56 Reply from 119.147.15.17: bytes=32 time=9ms TTL=56 Reply from 119.147.15.17: bytes=32 time=9ms TTL=56 Ping statistics for 119.147.15.17: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 9ms, Maximum = 9ms, Average = 9ms exec---------- popen---------- Pinging qq.com [119.147.15.17] with 32 bytes of data: Reply from 119.147.15.17: bytes=32 time=9ms TTL=56 Reply from 119.147.15.17: bytes=32 time=9ms TTL=56 Reply from 119.147.15.17: bytes=32 time=9ms TTL=56 Reply from 119.147.15.17: bytes=32 time=9ms TTL=56 Ping statistics for 119.147.15.17: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 9ms, Maximum = 9ms, Average = 9ms popen---------- Actual result: -------------- open_basedir:D:\Web\test.com\public\ system---------- system---------- passthru---------- passthru---------- shell_exec---------- shell_exec---------- exec---------- exec---------- popen---------- popen----------