Warning: file("../logs/pserver.log") -
Permission denied in /home/palacehosting/secret/web/log.php on line 3
So I went to php.net sure I was going to fix this on my own and not have to ask for help again. They said use the chmod()
So I added this text above the call for the log:
chmod ("../logs", 0777);
But now I get this when I refresh:
Warning: chmod failed: Operation not permitted in /home/palacehosting/secret/web/log.php on line 2
Warning: file("../logs/pserver.log") - Permission denied in /home/palacehosting/secret/web/log.php on line 3
I saw on the user comments on php.net about it not working unless your the same user, but when I went to chown() I didnt quite understand how to set that up. I will keep playing with it but any help would be appreciated!
Thanks
Knowles
chown("../logs", nobody);
and
chgrp("../logs", nobody);
I used nobody because I remember reading somewhere thats how PHP is considered or something.
IN both of them I get:
Warning: chown/chgrp failed: Operation not permitted in /home/palacehosting/secret/web/log.php on line 2/3
Hope this helps more
A thread not so long ago suggested to SUID the script that will call the commands as mode 4777 with owner/group the owner of the files that will be modified by the script.
Be aware: using a SUID script will be a security compromise, because if the script is cracked into the attacker will have the owner privileges and not the ones of Nobody; that is why the Nobody user exists in first place and why some operations are forbidden for it.
If you do an 'ls -l /home/palacehosting/secret/web/log.php' this will tell you what user owns the file. From the way it sounds you might have already done that and the owner is apache. Your next step would be to contact the person who starts the apache server and find out how you can get read permissions to this log file. I didn't read if you had said that this worked before and now it doesn't work? The best solution is to ask the owner of the file to give you permissions instead of using chmod to give yourself permissions.
I hope this helps.