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()
The web server runs as a different user, and that user does not have permission to write to your home directory.