I am using PHP to write files to a folder on a Windows 2000 Server. The folder has permissions for Everyone to have read access, but the files that are being created are not inheriting the permissions of the folder. The web page that is writing the files
is being authenticated using Windows credentials. If I allow anonymous access to that page, the permissions for the resulting file is okay, but when it is authenticated, the file can't be accessed by the SERVER_IUSR account.
The purpose of the page is to allow content authors to upload images to use in a content management system. The images are uploading and going where they need to go, but the permissions prevent them from being viewed through the resulting webpages. Correcting
the permissions on the uploaded files fixes the problem, but without the inheritance working, I'd have to fix each one.
Process Monitor is one tool which can assist you in finding out which credential is trying to access the file and why it is failing.
Also which PHP version you are using?
An additional thing you should remember, PHP upload works at two levels: first the file is uploaded to temporary directory (defined by php.ini directive upload_tmp_dir, details at
http://php.net/manual/en/ini.core.php) and then moved from this directory to actual directory. I do not have much knowledge about Windows 2000. But I believe you should allow inherit folder permission to your
upload temporary folder. Details at
http://support.microsoft.com/kb/313398. This is because move command will copy the permission as it is. So make sure that your upload_tmp_dir folder location is having appropriate permission so that it can be propagated properly. If you do not have upload_tmp_dir
set in your php.ini file, PHP automatically uses some temporary directory. For XP onward it is C:\Windows\Temp, not sure what the value is for Windows 2000.
dssapp
1 Post
File Permission Inheritance using IIS and PHP
Apr 09, 2010 07:57 PM|LINK
I am using PHP to write files to a folder on a Windows 2000 Server. The folder has permissions for Everyone to have read access, but the files that are being created are not inheriting the permissions of the folder. The web page that is writing the files is being authenticated using Windows credentials. If I allow anonymous access to that page, the permissions for the resulting file is okay, but when it is authenticated, the file can't be accessed by the SERVER_IUSR account.
The purpose of the page is to allow content authors to upload images to use in a content management system. The images are uploading and going where they need to go, but the permissions prevent them from being viewed through the resulting webpages. Correcting the permissions on the uploaded files fixes the problem, but without the inheritance working, I'd have to fix each one.
Any ideas?
PHP 5.0.51a permissions inheritance
don.raman
1207 Posts
Microsoft
Moderator
Re: File Permission Inheritance using IIS and PHP
Apr 09, 2010 09:31 PM|LINK
Hi,
Process Monitor is one tool which can assist you in finding out which credential is trying to access the file and why it is failing.
Also which PHP version you are using?
An additional thing you should remember, PHP upload works at two levels: first the file is uploaded to temporary directory (defined by php.ini directive upload_tmp_dir, details at http://php.net/manual/en/ini.core.php) and then moved from this directory to actual directory. I do not have much knowledge about Windows 2000. But I believe you should allow inherit folder permission to your upload temporary folder. Details at http://support.microsoft.com/kb/313398. This is because move command will copy the permission as it is. So make sure that your upload_tmp_dir folder location is having appropriate permission so that it can be propagated properly. If you do not have upload_tmp_dir set in your php.ini file, PHP automatically uses some temporary directory. For XP onward it is C:\Windows\Temp, not sure what the value is for Windows 2000.
Thanks,
Don.