PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Note: When safe mode is enabled, you can only execute files within the safe_mode_exec_dir. For practical reasons, it is currently not allowed to have .. components in the path to the executable.
astions, I tries your code and again nothing happens. there's no error message - just nothing is printed.
edited: I was mistaken, something does appear.
Last edited by TheStoryTeller on Tue May 19, 2009 2:56 pm, edited 1 time in total.
The difference between exec() / system() and the ` operator is that the functions return only the last line of the output, and if it is a empty string, or if output is piped to /dev/null, you won't receive anything.
` operator, like the passthru function, return the whole output.
Darhazer wrote:The difference between exec() / system() and the ` operator is that the functions return only the last line of the output, and if it is a empty string, or if output is piped to /dev/null, you won't receive anything.
` operator, like the passthru function, return the whole output.
Try using passthru and see the results, maybe your server outputs a empty line at the end. On my hosting, both passthru('whoami') and echo exec('whoami') output my username.