I've been struggling to get PHP readfile() to work properly. After drilling down all options, it turns out that I can not get this to work when I am trying to open a file that is located on another partition. My webroot folder is located under the root partition (
/webroot), and I want to access files located under
- Permissions are just fine
- open_basedir is deactivated
- If I move the same folder and files to a folder under
/, then it all works, but if it's located under
/home, then it does not work anymore. Permissions are 777 and owner of the folder is Apache, so it is really not a file permission issue.
Here's my fstab:
# /dev/sda1 UUID=... / ext4 rw,relatime,data=ordered 0 1 # /dev/sda6 UUID=... /home ext4 rw,relatime,data=ordered 0 2
The error I'm getting is:
Warning: readfile(/home/files/1.txt): failed to open stream: Permission denied in /webroot/download.php
I'm not finding any partition-related limitations in the documentation. My logfiles do not indicate any particular error either. I do not have selinux installed.
EDIT: open_basedir is NOT at fault. I have checked this thoroughly. Both by specifically including the folder that is at stake, and by commenting out the whole open_basedir directive. Also, if I do force an open_basedir error, then the actual error message is different.
Current open_basedir setting:
Using Arch Linux, PHP 5.4.13
Any idea what this could be?