Ok, is there a way for the PHP user (www-data) to gain access to other parts of the server, for example, /home/username/another_folder/ ?? Thanks in Advance.
Will
EDIT: Do I just add www-data to another group?? Or something like that, or is there another way?
You can create another group and add the
www-data(if your webserver runs underwww-datauser) to this group, then assign this group to all those files you want to be accessible.Or if you just need the read permission, and it is not an issue that other users on the system have read access to your files, then just change permissions of your files (in other places) to have the read permission for
other. For example,775for your directories and644for your files.Remember that you can not serve pages in places other than your Document Root (for example /var/www), even though your webserver user has the permissions to access those files.
However if you configure “aliases” or “virtual hosts” for your web server, you can make places other that your default document root, accessible by HTTP requests.
But PHP files that are under your document root and executed by the web server, CAN read contents of files outside the document root IF the web server user has enough permissions.