I'm running Apache 2.4 and PHP 7 on CentOS 7. I run a web-based file server. The directory structure looks like this:
/var/www/example.com/public_html # Document Root
/var/www/file-transfer-center/ # Location of files for file server
Everything works great, but the partition that these files reside on is getting full. There is another partition on the machine:
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 953.8G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 953.3G 0 part
├─centos-root 253:0 0 50G 0 lvm /
├─centos-swap 253:1 0 4G 0 lvm [SWAP]
└─centos-home 253:2 0 899.2G 0 lvm /home
sdb 8:16 0 500G 0 disk
└─sdb1 8:17 0 500G 0 part
sdc 8:32 0 1000G 0 disk
└─sdc1 8:33 0 1000G 0 part
sr0 11:0 1 1024M 0 rom
And if I run df -aTh | grep centos
:
/dev/mapper/centos-root xfs 50G 17G 34G 34% /
/dev/mapper/centos-home xfs 899G 34G 866G 4% /home
So it looks to me like I can just move my file-transfer-center
directory to /home
and I'll be all set.
I copied the files and changed the configuration of the path of my file transfer software to /home/file-transfer-center
, but when I try to access the files, php-fpm
gives me the error:
PHP Fatal error: Uncaught LogicException: The root path /home/file-transfer-center is not readable.
I checked the permissions and the file-transfer-center
and all if it's contents are owned by apache
and in the wheel
group with 775 and 664 rights on directories and files, respectively.
I wrote a simple test:
var_dump(fopen('/home/file-transfer-center/fa498800-4102-46be-a7a6-3384f242a949', 'r'));
And it results in false
. If I replace the path in that test with the original file-transfer-center
path, it results in resource(5) of type (stream)
.
I checked open_basedir
, it is not set. Same with user_dir
. I can't find anything that would indicate that the directory would be off limits to PHP.
What am I missing here? Am I correct in my analysis that /home
is running on a separate logical partition of the same physical drive? Does that have something to do with it?
How can I explicitly tell PHP that it's cool to access /home/file-transfer-center
?
EDIT: My web server is running as user apache
and the /home/file-transfer-center
directory is owned by apache
:
drwxrwxr-x. 2 apache wheel 60K Jan 11 17:12 file-transfer-center
I believe that your *nix file system doesn't care how many actual hard drives you have. All of the files are unified as a single file system.
You cannot just move files or your file-transfer-center directory into the /home directory. That directory, at least on my system, is owned by root:
$ ls -dal /home
drwxr-xr-x 4 root root 4096 Apr 28 2016 /home
You would need sudo privileges in order to move any file or directory into the /home directory.
If you just moved the directory file-transfer-center from /var/www/file-transfer-center to /home/file-transfer-center, I would imagine this directory still has its same permissions. However, if you created a new directory named /home/file-transfer-center and copied the contents and subdirectories into it, then it might be owned by root:root. I suggest you check the permissions on /home/file-transfer center with this command:
ls -dal /home/file-transfer-center
And see if apache has access to it.
You should also make sure that you are assigning the correct permissions for your web server. To find out which server the web server is, access this PHP script via your webserver:
<?
passthru("whoami");
it should output the name of the username of your web server. That user should have read and/or write access to the /home/file-transfer-center directory.
EDIT: Looking more closely at the OP, I see there's a little period (.) at the end of the file permissions -- apparently this denotes a SELinux restriction. SELinux can restrict apache access to home directories. Consider moving file-transfer-center directory back to /var/www/file-transfer-center -- can you mount the second drive there instead?