PHP SAFE MODE Restriction in effect 的有关问题

WBOY
Release: 2016-06-13 13:08:01
Original
669 people have browsed it

PHP SAFE MODE Restriction in effect 的问题

当safe_mode设置为 on,PHP 将通过文件函数或其目录检查当前脚本的拥有者是否和将被操作的文件的拥有者相匹配。例如:-rw-rw-r--  1 rasmus rasmus    33 Jul 1 19:20 script.php
  -rw-r--r--  1 root  root    1116 May 26 18:01 /etc/passwd
  运行 script.php  readfile('/etc/passwd');
  ?>
  如果安全模式被激活,则将会导致以下错误:Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not
  allowed to access /etc/passwd owned by uid 0 in /docroot/script.php on line 2

  haohappy的说法:
  原因在于你使用了安全模式,而你上传文件的用户uid和拥有者的uid不同,导致没有访问权限。比如安全模式下,你的ftp上传用户uid为123,而上传后拥有者的uid为456,就会出现这样的错误。

  有两种解决方法:
  1。关闭安全模式;
  2。在命令行下chown改文件/目录的拥有者
  当然两种方法都要求你有服务器的权限。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!