Permission Denied Despite Appropriate Permissions Using PHP

Permission denied despite appropriate permissions using PHP

Your directory needs execute permission for this to work. It does not seem to have world execute, and since jenkins is probably not the apache user, and the apache user is not in the adm group, it wouldn't work:

$ ls -lh /var/lib/ | grep jenkins
drwxr-xr-- 6 jenkins adm 4.0K 2011-08-04 10:04 jenkins

Per example:

netcoder@netcoder:~$ mkdir foo
netcoder@netcoder:~$ echo hello > foo/bar
netcoder@netcoder:~$ chmod 777 foo/bar
netcoder@netcoder:~$ ls -lsah foo/bar
4.0K -rwxrwxrwx 1 netcoder netcoder 6 2011-08-04 08:22 foo/bar
netcoder@netcoder:~$ chmod 444 foo/
netcoder@netcoder:~$ ls -lsah | grep foo
4.0K dr--r--r-- 2 netcoder netcoder 4.0K 2011-08-04 08:22 foo
netcoder@netcoder:~$ cat foo/bar
cat: foo/bar: Permission denied

Even though foo/bar has 0777 permission, if the directory does not have the execute permission, reading its contents is denied.

You'll need the permission to be set for both the target directory and the symbolic link.

fopen() - permission denied - despite having correct permissions (as far as I can tell)

You write to /var/www/memcache.log, not /var/www/logs/memcache.log for which you show permissions.

(why do you read the log before writing to it?)

Why do I get permission denied in PHP when trying to rename a directory?

You're editing the higher level directory, so the PHP user needs to have write access to that directory.

fopen() Permission Denied despite having correct file directory

Maybe, you have no premissions to acces the file. One of the answet, is that, you must change CHMOD to e.g. 777. You can co it with your ftp explorer or with PHP.

chmod("/somedir/somefile", 777);


Related Topics



Leave a reply



Submit