Home > php教程 > php手册 > body text

php安全配置详细说明(1/2)

WBOY
Release: 2016-06-13 10:11:39
Original
858 people have browsed it

(1) 打开php教程的安全模式
  php的安全模式是个非常重要的内嵌的安全机制,能够控制一些php中的函数,比如system(),
  同时把很多文件操作函数进行了权限控制,也不允许对某些关键文件的文件,比如/etc/passwd,
  但是默认的php.ini是没有打开安全模式的,我们把它打开:
  safe_mode = on


(2) 用户组安全
  当safe_mode打开时,safe_mode_gid被关闭,那么php脚本能够对文件进行访问,而且相同
  组的用户也能够对文件进行访问。
  建议设置为:
  safe_mode_gid = off
  如果不进行设置,可能我们无法对我们服务器网站目录下的文件进行操作了,比如我们需要
  对文件进行操作的时候。


(3) 安全模式下执行程序主目录
  如果安全模式打开了,但是却是要执行某些程序的时候,可以指定要执行程序的主目录:
  safe_mode_exec_dir = d:/usr/bin
  一般情况下是不需要执行什么程序的,所以推荐不要执行系统程序目录,可以指向一个目录,
  然后把需要执行的程序拷贝过去,比如:

  safe_mode_exec_dir = d:/tmp/cmd

  但是,我更推荐不要执行任何程序,那么就可以指向我们网页目录:

  safe_mode_exec_dir = d:/usr/www

 

1 2

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 Recommendations
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!