app教程网 综合百科 php常见问题(php开发中遇到的难点)

php常见问题(php开发中遇到的难点)

Open_basedir: Restrict the files that users can operate to a certain directory; ————3——3——3————33333333333333333333333333333333333333333333333333344-the following is the original description and the default configuration in php.ini: Open_basedir, if set, limits all file operations to the defined directory; And below. This directive is most meaningful if used in every directory or; Web server configuration file for each virtual host. This instruction is; * is not affected by the safe mode on or off. open_basedir=。 Open_basedir can limit users' access to files to a specified area,

Open_basedir还可以同时设置多个目录,在Windows中用分号分隔目录,在任何其他系统中用冒号分隔目录。当它作用于Apache模块时,会自动继承父目录中的open_basedir路径。

有三种方法可以在Apache中为指定用户进行独立设置:

(一)Apache的httpd.conf中目录的对应设置方法:

PHP _ admin _ value open _ basedir/usr/local/Apache/htdocs/#设置多个目录可以参考如下:PHP _ admin _ value open _ basedir/usr/local/Apache/htdocs/:/tmp/

(二)在街头流氓的httpd.conf中虚拟主机的相应设置方法:PHP _ admin _ value open _ basedir/usr/local/Apache/htdocs/#设置多个目录可以参考如下:PHP _ admin _ value open _ basedir/var/www/html/:/var/tmp/

(c)由于在VirtualHost中设置open_basedir后,该虚拟用户将不再自动继承php.ini中open_basedir的设置值,从而难以实现灵活的配置措施,建议您不要在VirtualHost中设置此限制。例如,可以设置open_basedir=。/tmp/

请注意:如果php.ini中设置的上传文件的临时目录是/tmp/,那么在设置open_basedir时必须包含/tmp/,否则上传会失败。新版php会提示“open _ basedir限制生效”的警告信息,但move_uploaded_file()函数仍然可以成功检索/tmp/目录中的上传文件。不知道是不是这样。

本文来自网络,不代表本站立场,转载请注明出处:https: