hellopasswd
php-fpm定义open_basedir
vi /usr/local/php-fpm/etc/php-fpm.d/user.conf php_admin_value[open_basedir]=/data/wwwroot/user.com:/tmp/
创建测试php脚本,进行测试
再次更改user.conf,修改路径,再次测试
配置错误日志
再次测试
查看错误日志
[root@localhost php-fpm.d]# vi www.conf
1 [www]
2 listen = /tmp/php-fcgi.sock
3 listen.mode = 666
4 user = php-fpm
5 group = php-fpm
6 pm = dynamic
7 pm.max_children = 50
8 pm.start_servers = 20
9 pm.min_spare_servers = 5
10 pm.max_spare_servers = 35
11 pm.max_requests = 500
12 rlimit_files = 1024
13 request_slowlog_timeout = 1
14 slowlog = /usr/local/php-fpm/var/log/www-slow.log
15 php_admin_value[open_basedir]=/data/wwwroot/test.com:/tmp/
[root@localhost php-fpm.d]# /usr/local/php-fpm/sbin/php-fpm -t
[10-Jan-2018 09:06:36] NOTICE: configuration file /usr/local/php-fpm/etc/php-fpm.conf test is successful
[root@localhost php-fpm.d]# /etc/init.d/php-fpm reload
Reload service php-fpm done
[root@localhost php-fpm.d]# curl -x 127.0.0.1:80 test.com/3.php
open_basedir 的作用是限制php在指定的目录里活动
/display_errors
462 ; Default Value: On
463 ; Development Value: On
464 ; Production Value: Off
465 ; http://php.net/display-errors
466 display_errors = Off
467
468 ; The display of errors which occur during PHP's startup sequence are handled
469 ; separately from display_errors. PHP's default behavior is to suppress those
470 ; errors from clients. Turning the display of startup errors on can be useful in
471 ; debugging configuration problems. We strongly recommend you
472 ; set this to 'off' for production servers.
473 ; Default Value: Off
不允许让其他人访问到错误日志
/error_log
572 ;error_log = php_errors.log
573 ; Log errors to syslog (Event Log on Windows).
574 ;error_log = syslog
575 error_log = /usr/local/php-fpm/var/log/php_error.log
576
577 ;windows.show_crt_warning
578 ; Default value: 0
579 ; Development value: 0
580 ; Production value: 0
添加error_log = /usr/local/php-fpm/var/log/php_error.log
/error_reporting
446 ; Development Value: E_ALL
447 ; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
448 ; http://php.net/error-reporting
449 #error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
450 error_reporting = E_ALL
451
452 ; This directive controls whether or not and where PHP will output errors,
453 ; notices and warnings too. Error output is very useful during development, but
454 ; it could be very dangerous in production environments. Depending on the code
添加450注释449
[root@localhost php-fpm.d]# grep error_log /usr/local/php-fpm/etc/php.ini
; server-specific log, STDERR, or a location specified by the error_log
; Set maximum length of log_errors. In error_log information about the source is
;error_log = php_errors.log
;error_log = syslog
error_log = /usr/local/php-fpm/var/log/php_error.log
; OPcache error_log file name. Empty string assumes "stderr".
;opcache.error_log=
修改于 180110