Can't open file in php if one of directories is a symlink

拟墨画扇 提交于 2019-12-11 10:02:39

问题


I have 3 sites live, staging and development, devel site have copy of all files from live and database copy but staging is not since they are both on the same physical server (staging and devlopment) I want to synlink files from dev to live (it's 30GB) but my php script can't open files where one directory in path is symlink.

I have symlink

/srv/www/staging.server.com/htdocs/people/ to /srv/www/dev.server.com/htdocs/people/

and I have example file /srv/www/dev.server.com/htdocs/people/gnokii/zuluwarrior.svg I can access it (by /srv/www/staging.server.com/htdocs/people/zuluwarrior.svg) from comman line and from the browser but php can't open that file.

file_exists return false and file return empty array. (I have code that convert svg to png that work on both live and dev server but don't on staging because of this).

Is there some php config that disble synlinks? I found suhosin.executor.allow_symlink = Off but I think it's for executing scripts. Any ideas, how to fix this?


回答1:


I found the reason base_dir was set to '/srv/www/staging.server.com' and suhosin.executor.allow_symlink was set to Off

This flag reactivates symlink() when open_basedir is used, which is disabled by default in Suhosin >= 0.9.6. Allowing symlink() while open_basedir is used is actually a security risk.



来源:https://stackoverflow.com/questions/11560747/cant-open-file-in-php-if-one-of-directories-is-a-symlink

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