note 94262 added to function.system
| From: | ca@php.net.spamtrak.org | Date: | Mon, 26 Oct 2009 08:48:40 +0000 |
| Subject: | note 94262 added to function.system | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-162094@lists.php.net to get a copy of this message | ||
If you don't want the output of your command echoed to STDOUT while using PHP for scripting
(Unix/CLI) use exec() instead of system().
May apply to CGI versions, YMMV.
<?
$cmd = "date";
$output = system($cmd);
printf("System Output: $output\n");
exec($cmd, $results);
printf("Exec Output: {$results[0]}\n");
/*
Output:
Mon Oct 26 19:30:08 EST 2009
System Output: Mon Oct 26 19:30:08 EST 2009
Exec Output: Mon Oct 26 19:30:08 EST 2009
*/
?>
----
Server IP: 64.71.164.2
Probable Submitter: 68.178.146.170
----
Manual Page -- http://www.php.net/manual/en/function.system.php
Edit -- https://master.php.net/note/edit/94262
Del: integrated -- https://master.php.net/note/delete/94262/integrated
Del: useless -- https://master.php.net/note/delete/94262/useless
Del: bad code -- https://master.php.net/note/delete/94262/bad+code
Del: spam -- https://master.php.net/note/delete/94262/spam
Del: non-english -- https://master.php.net/note/delete/94262/non-english
Del: in docs -- https://master.php.net/note/delete/94262/in+docs
Del: other reasons-- https://master.php.net/note/delete/94262
Reject -- https://master.php.net/note/reject/94262
Search -- https://master.php.net/manage/user-notes.php