Msg#: 4419026 posted 2:21 am on Feb 18, 2012 (gmt 0)
What user is PHP running as?
In some installations it runs as Apache:Apache and others runs as the account Group:Owner , and can only set permissions on a directory if it's a directory where the permissions of PHP match those of the directory.
I have a situation on one server where I had to make a cron job running as root change the permissions on the directory for me because of such a mismatch problem. Normally it's something more easily fixed, but because I used a Plesk control panel for managing that server the cron job was the best solution I could find.
Msg#: 4419026 posted 5:14 pm on Feb 20, 2012 (gmt 0)
Right, it's not always permissions, sometimes it's ownership. An example, if you upload a file via FTP under your account user, then try to chmod it with a script, you will get permission denied, and vice versa. These are different owners.
But your error trapping (good!) is telling you what the problem is. No such file or directory (NOT permission denied.) And you likely want to use the full path.