note 129011 added to function.passthru

From: Date: Mon, 06 Nov 2023 23:18:03 +0000
Subject: note 129011 added to function.passthru
Groups: php.notes 
Request: Send a blank email to php-notes+get-220967@lists.php.net to get a copy of this message
Cross function solutions for execute command using PHP- function php_exec( $cmd ){ if( function_exists('exec') ){ $output = array(); $return_var = 0; exec($cmd, $output, $return_var); return implode( " ", array_values($output) ); }else if( function_exists('shell_exec') ){ return shell_exec($cmd); }else if( function_exists('system') ){ $return_var = 0; return system($cmd, $return_var); }else if( function_exists('passthru') ){ $return_var = 0; ob_start(); passthru($cmd, $return_var); $output = ob_get_contents(); ob_end_clean(); //Use this instead of ob_flush() return $output; }else if( function_exists('proc_open') ){ $proc=proc_open($cmd, array( array("pipe","r"), array("pipe","w"), array("pipe","w") ), $pipes); return stream_get_contents($pipes[1]); }else{ return "@PHP_COMMAND_NOT_SUPPORT"; } } ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 37.111.223.98) ---- Manual Page -- https://php.net/manual/en/function.passthru.php Edit -- https://main.php.net/note/edit/129011 Del: integrated -- https://main.php.net/note/delete/129011/integrated Del: useless -- https://main.php.net/note/delete/129011/useless Del: bad code -- https://main.php.net/note/delete/129011/bad+code Del: spam -- https://main.php.net/note/delete/129011/spam Del: non-english -- https://main.php.net/note/delete/129011/non-english Del: in docs -- https://main.php.net/note/delete/129011/in+docs Del: other reasons-- https://main.php.net/note/delete/129011 Reject -- https://main.php.net/note/reject/129011 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220967) next »