I have a PHP script involving exec() that will run fine from the command line but not in a web context. The script is simply this:
exec()
Your web server probably (correctly) doesn't have the appropriate permissions to write to a home directory.