因为设置ecms的php环境不当,导致图片不能上传,报错说文件夹权限没有设置为777
经检查发现原来是因为安全考虑在php.ini文件中设置了
open_basedir= /usr/local/www
正确的设置方法应该是
open_basedir= /usr/local/www:/tmp/ 并附上以下帮助文档
open_basedir: 将用户可操作的文件限制在某目录下;
——————————————————————————–
如下是php.ini中的原文说明以及默认配置:
; open_basedir, if set, limits all file operations to the defined directory
; and below. This directive makes most sense if used in a per-directory or
; per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
open_basedir = .
open_basedir可将用户访问文件的活动范围限制在指定的区域,通常是其家目录的路径,也可用符号”.”来代表当前目录。注意用open_basedir指定的限制实际上是前缀,而不是目录名。
举例来说: 若”open_basedir = /dir/user”, 那么目录 “/dir/user” 和 “/dir/user1″都是可以访问的。所以如果要将访问限制在仅为指定的目录,请用斜线结束路径名。例如设置成:
“open_basedir = /dir/user/”