標籤:php
1、/usr/local/php7/etc/php.ini是php的設定檔
[[email protected] ~]# /usr/local/php7/bin/php -i | grep -i ‘loaded configuration file‘Loaded Configuration File => /usr/local/php7/etc/php.ini
2、禁用不安全的功能
[[email protected] ~]# cat /usr/local/php7/etc/php.ini |grep disable_functionsdisable_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,phpinfo##如果禁用eval函數,就算可以上傳php檔案也是不能執行的。##禁用phpinfo防止網站php資訊泄露。
3、錯誤資訊處理
[[email protected] ~]# vi /usr/local/php7/etc/php.inidisplay_errors = Off ##遊覽器不返回錯誤資訊log_errors = On ##記錄錯誤記錄檔error_log = /tmp/php_errors.log ##定義錯誤記錄檔存放路徑error_reporting = E_ALL & ~E_NOTICE ##設定錯誤記錄檔等級
4、時區
[[email protected] ~]# vi /usr/local/php7/etc/php.inidate.timezone = Asia/Shanghai
5、open_basedir
[[email protected] ~]# vim /usr/local/apache2.4/conf/extra/httpd-vhosts.confphp_admin_value open_basedir "/data/www/123.com:/tmp/"##允許先上傳到tmp目錄下,然後再次轉到其他目錄下
本文出自 “Gorilla Grodd” 部落格,請務必保留此出處http://juispan.blog.51cto.com/943137/1953450
LAMP-php配置最佳化