2.8 php.ini配置文件详解

#/usr/local/php/bin/php –i|head  //查看php.ini路径为/usr/local/php/etc/php.ini

  1. 一、配置disable_function

#vim /usr/local/php/etc/php.ini

disable_functions=eval,assert,popen,passthru,escapeshellarg,escapeshellcmd,passthru,exec,system,chroot,scandir,chgrp,chown,escapeshellcmd,escapeshellarg,shell_exec,proc_get_status,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,leak,popepassthru,stream_socket_server,popen,proc_open,proc_close

//禁止掉这些函数

  1. 二、配置error_log

#vim /usr/local/php/etc/php.ini

display_errors=off         //如果为on则在浏览器访问显示错误

log_errors=on

error_log =/usr/local/php/logs/php_errors.log

# mkdir /usr/local/php/logs/     //创建错误日志生成目录

# chmod 777 !$       //权限改为777

找到error_reporting修改为error_reporting = E_ALL | E_STRICT

# /usr/local/apache2/bin/apachectl graceful    //重新加载

  1. 三、配置open_basedir

#vim /usr/local/php/etc/php.ini

open_basedir = /data/www/:/tmp/    //限制用户只能访问/data/www和/tmp目录

#vim httpd.conf        //可以在Apache中修改

php_admin_value open_basedir “/data/www/:/tmp/”      限制用户访问


你可能感兴趣的:(2.8 php.ini配置文件详解)