I want to move my data directory outside of the web root. I have file paths stored in my database and would like to be able to redirect looking for files through a symlink instead of having to change the saved paths.
Example, currently I have a structure like this:
/root/webroot/data/file.ext
And my database path will be: /root/webroot/data/file.ext as well. I'd like to move data outside of webroot so I have:
/root/data/file.ext
/root/webroot/data -> root/data
Where /root/webroot/data is a linux style symlink to root/data. I have set this up, but when I do a readfile on the previously stored path (/root/webroot/data/file.ext) it fails. I.e. I do this:
readfile('/root/webroot/data/file.ext');
I get back:
Warning: readfile(/root/webroot/data/file.ext) [function.readfile]: failed to open stream: No such file or directory in [file] on line ...
Is there anything I can do to help these paths resolve?
Note: The permissions of the folders and files all match. That of the symlink is root:root, from which it was created, but chown doesn't seem to work on it.