note 51649 deleted from function.exec by betz
| From: | betz@php.net | Date: | Wed, 06 Apr 2005 15:34:58 +0000 |
| Subject: | note 51649 deleted from function.exec by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-87588@lists.php.net to get a copy of this message | ||
Note Submitter: Benjamin Mack
Reason: spam
----
If you have safe_mode enabled I think there is no way to use this function when you want to use the
I/O-Redirection to e.g. output in a file:
<?php
$cmd = '/path_to_safe_mode_directory/ls -alh >myfile.log';
exec($cmd);
?>
safe_mode encloses every parameter in quotes, so your call would be actually executed like this:
<?php
exec('/path_to_safe_mode_directory/ls "-alh" ">myfile.log"');
?>
There is no way (at least after 6 hours of testing and trying) in changing this except
a) turning safe_mode off or
b) creating a hardcoded bashscript to call
<?php
$cmd = '/path_to_safe_mode_directory/myownbashscript.sh';
exec($cmd);
?>
But then you loose the the possiblity to use a dynamic I/O redirecting, what I really didn't
like sadly...