'PHP has permission denied on simlink
Could I ask for some help with PHP and permissions on Linux. I'm trying to move log files from /var/www/html/log to /home/user/log and then created symbolic link to it. I have used command
ln -s /home/user/log/ log
to create the link and made sure to give permissions 755 (even 777) to both link and folder /home/user/log, as well as owner set to apache:apache on both. But I get permission denied all the time even if I try to just list the files over the symlink. Tried adding to httpd.conf below:
<Directory "/var/www">
Options Indexes FollowSymLinks
AllowOverride None
# Allow open access:
Require all granted
</Directory>
<Directory "/home/user/log">
Options Indexes FollowSymLinks
AllowOverride None
# Allow open access:
Require all granted
</Directory>
New folder location permissions
drwxrwxrwx. 3 apache apache 4.0K Feb 15 11:19 log
Symlink permissions
lrwxrwxrwx. 1 apache apache 17 Feb 15 12:57 log -> /home/user/log/
Error from php in chrome browser
Warning: scandir(/var/www/html/log): failed to open dir: Permission denied in /var/www/html/test.php on line 2
test.php code
<?php
$files = scandir('/var/www/html/log');
echo '<pre>';
print_r($files);
echo '</pre>';
?>
Output of ls -ld /home/user /home/user/log
drwxrwxrwx. 28 user user 4096 Feb 15 11:18 /home/user
drwxrwxrwx. 3 apache apache 4096 Feb 15 12:57 /home/user/log
What am I missing??
Thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
