2.8 php.ini配置文件詳解

#/usr/local/php/bin/php –i|head  //查看php.ini路徑爲/usr/local/php/etc/php.iniphp

  1. 1、配置disable_functionshell

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

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_closevim

//禁止掉這些函數瀏覽器

  1. 2、配置error_logsocket

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

display_errors=off         //若是爲on則在瀏覽器訪問顯示錯誤spa

log_errors=onrest

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. 3、配置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/」      限制用戶訪問

相關文章
相關標籤/搜索