1
votes

I'm trying to access a mounted drive from within PHP/Apache (LAMP @ CentOS). For instance by doing a scandir:

scandir($dir);

Although this works fine for any directory which is on the same physical disc Apache is installed at (including root, var, etc, ..), It does not work for external mounted disks:

scandir('/var/log'); which is on the local drive that also holds /var/www/html

delivers valid output, whereas

scandir('/mnt/data'); (which is a mount to an external fs) doesn't.

I have been experimenting with filesystem permissions and httpd.conf directives (Alias / Directory), but have not been able to find the solution yet.

Can anyone point me into the direction of how to access external drives (/mnt/whatever) from apache/PHP? Thx!

1

1 Answers

0
votes

If the process can see the mount point then it will be able to access the files within it provided that permissions, including acls and any MAC system allow it (MAC here referring to mandatory access control systems, I.e. selinux and apparmor).

Either your permissions need to be changed or the webserver is running in a chroot environment (e.g. what it sees as / is really /var/websrv/) or you have not made the right changes to your httpd config.

Since you've provided no details of how the system is configured not what you've tried its not possible to be any more specific.