Chevereto 图床上传图片的时候发现一个故障,没有写入和移动的权限。
Chevereto 用户将需要 进行 读/写 在以下路径中 访问:
app/content/ app/content/languages/ app/content/languages/cache/ app/content/system/ content/ images/ /tmp
刚开始的时候,我想限制 PHP 只访问指定的网站目录,然后保证网站安全性。于是配置的是 open_basedir = "/web/"
但是后来发现,php 脚本里有先上传到临时文件夹,然后当拷贝文件到指定目录时,操作执行不了
经过相关排查,最后定位到/tmp/没有允许 php 写入的权限。于是配置成 open_basedir = "/web/:/tmp/"
php 和 tmp 相关可疑的文件权限的配置参数
; Sets the directory name where SOAP extension will put cache files.
; http://php.net/soap.wsdl-cache-dir
soap.wsdl_cache_dir="/tmp"
; 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.
; http://php.net/open-basedir
open_basedir = "/web/:/tmp/"
; Directory where the temporary files should be placed.
; Defaults to the system default (see sys_get_temp_dir)
; sys_temp_dir = "/tmp"
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
;upload_tmp_dir =
; where MODE is the octal representation of the mode. Note that this
; does not overwrite the process's umask.
; http://php.net/session.save-path
;session.save_path = "/tmp"