I need to run a mysqldump as a system function via php.

Ubuntu runs it fine in the terminal.
But I can't get it to work via php.

Here's the summary:

1. no errors returned.
2. I tried also exec and passthru instead of system.
3. With system, the return value is 2 - and I have no clue what it means.

Any thoughts?