shell_exec() is a very bad way of executing commands just because leaving it open, you're leaving your server a whole lot more vulnerable if someone exploits your PHP code, or manages to upload a PHP file. Instead, if you can, you should use PHP functions like mkdir() and fopen($file, '(r|a|w)+) so your file is created if it doesn't exist. In fact, leaving shell_exec(), exec(), pass_thru() and the like in your code, any exploits can execute shell commands on your server.
Now, in relation to the original question, have you checked permissions on the files and directories you're attempting to work with? The user running your PHP needs to have permission to work with the files and directories you're attempting to access. If you're unsure, just chmod 777 any of your files and directories that you need to use in PHP.