Php – Flex: showing output of a C file in a text Area

apache-flexPHP

I managed to show the output of a shell command in TextArea of flex by calling following php file via HTTPService and then using the dataprovider attribute of TextArea to show the returned output.

<?php
$output = shell_exec('ls -l');
return $output
?>

Now i have a C file which prints some lines (by using printf command of C) when i run it in shell using

./myCfile

But following php code seems to not return anything as my TextArea remains empty

<?php
$output = shell_exec('./myCfile');
return $output
?>

Am i missing something here?

Best Answer

When you execute a shell command in php, the user running the command is the user running the web server daemon, and that user may not have the rights to run your C application. Make sure you gave rights to that user over your C application and try again. Also, that application must output to the standard output, if it outputs elsewhere (such as error output), shell_exec() won't return that content.

Related Topic