简体   繁体   中英

File permission problems with PHP

I am trying to create a folder and fopen a file inside that folder.

mkdir works fine for creating the folder (as the parent folder has 777 permission), but the resulting folder is owned by user id 99 while the script itself is running under cpanel with user id 32024. Now when I try to create a file inside this folder, I get:

SAFE MODE Restriction in effect. The script whose uid is 32024 is not allowed to access /<path_of_file>/<folder_created_by_php> owned by uid 99

This error is fully justifiable as I am trying to write to a folder owned by someone else but how can a script running under 32024 create a folder with owner as 99? Anything wrong with the way server is behaving? Any ideas?

创建该文件后,您可以尝试将用户99和32024都包含在同一个组中,并使用chmod('yourfilename',0775)

Your problem is related to the safe mode setting on php:

Check this out for more information: http://www.serverschool.com/dedicated-servers/what-is-php-safe-mode/ You'll have all the information to understand what is safe mode actually...

Just ask for your developers NOT to use safe_mode as it is a features unrecommended on all servers these days...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM