linux - Php - System function - /usr/bin/echo Hello : No such file or directory -
i'm newbie php. when run linux terminal command using system
function in php, i'm getting errors in error_log
. here code:
if(isset($_post['submit_button'])) { $name=$_post['user_name']; // here $name contains 'john' echo '<pre>'; $command="/usr/bin/echo $name"; $command1="'".$command."'"; $last_line = system($command1, $retval); echo '</pre> <hr />last line of output: ' . $last_line . ' <hr />return value: ' . $retval; }
when run code, i'm getting next errors:
in browser - giving code : 127 in /var/log/httpd/error_log file - sh: /usr/bin/echo john: no such file or directory
am missing anything? in advance.
try echo, , not /usr/bin/echo alter command variable declaration follow :
$command="echo $name";
php linux
No comments:
Post a Comment