If you are getting permission errors in Windows - ensure you are using the correct syntax for the directory. Check by echoing getcwd() and making sure your path is correct first off.
You should be able to see any issues this way, as this is not normally an actual "security / permissions" error. If it is - allow the IUSER_machinename to have full control if using IIS...