My webserver is run as daemon
. I know about security and so on but please ignore this for now. My problem is that I've done:
> chmod 777 /web/htdocs/olivier/wogwog/transit/02.done
> ls -al /web/htdocs/olivier/wogwog/transit
drwxrwxrwx 2 hqfdev hqfdev 36K Jan 17 14:41 02.done
So the directory belongs to user hqfdev
/ group hqfdev
. Here's my Php code:
$tmp_name='/web/htdocs/olivier/wogwog/transit/02.done/caca.txt';
if (($handle=@fopen($tmp_name, 'w'))!==false) {
fclose($handle);
error_log('OOOOOOOOOK');
} else {
error_log('error');
}
I keep getting this in my logs:
[snip] [:error] [snip] current running = daemon, referer: http://www.blabla/
[snip] [:error] [snip] PHP Warning: fopen(...): failed to open stream: Permission denied in /blabla.php on line 5, referer: http://www.blabla/
[snip] [:error] [snip] error, referer: http://www.blabla/
So the process that tries to create the file is daemon
and it cant write to a 777 folder that belongs to hqfdev
. (*.*)
. I'm totally stuck because I've done this a billion times and it worked. For your information, if I ssh
my server, log in as hqfdev
and launch that script "by hand", it works. What could be the problem (and of course the solution)?
I've found the solution: the parent folder didn't give the right to its children:
Configuration that doesn't work
$ ls -al /web/htdocs/olivier/wogwog
drwx------ hqfdev hqfdev transit
$ ls -al /web/htdocs/olivier/wogwog/transit
drwxrwxrwx hqfdev hqfdev 02.done
Now the configuration that works :
$ ls -al /web/htdocs/olivier/wogwog
drwxr-xr-x hqfdev hqfdev transit
$ ls -al /web/htdocs/olivier/wogwog/transit
drwxrwxrwx hqfdev hqfdev 02.done
...pure Unix lack of knowledge...
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.