allow php files to write to locations other than those owned by www-data

走远了吗. 提交于 2019-12-11 12:52:23

问题


I am able to write content from a php file opened in the browser to a certain location /var/www/data which I configured as follows

cd /var/www/
sudo mkdir data
sudo chown www-data:www-data data
sudo chmod 755 data

However, is it possible to write similar data to another location like /var/www/html/MyProjectRootFolder which is not owned by www-data ?


回答1:


Generally the web server's configuration is not going to allow applications to write to folders outside of their own Doc root. However, you could do something like symlink /var/www/html/MyProjectRootFolder to a location like /var/www/data within your Doc root that the application already can write to.

Depending, you may also need to make sure that the web server user still has read permissions to the symlinked content, or that won't work either.



来源:https://stackoverflow.com/questions/37037874/allow-php-files-to-write-to-locations-other-than-those-owned-by-www-data

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!