PHP.ini configuration file (Configure PHP error log)
The first step disables some high-risk functions & opens the error log
[Email protected] etc]# Vim/usr/local/php/etc/php.ini
Disable_functions = Eval,passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status, Ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_ Server,fsocket,fsockopen
Display_errors = On
[Email protected] etc]# apachectl-t
Syntax OK
[Email protected] etc]# apachectl restart
Let's do the test below:
[Email protected] etc]# vim/data/www/forum.php
Under Forum.php, add a line of PHP that doesn't know anything.
<?php
Wellcome to Wuhan 2016-10-01
Refresh the page, the page error.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/88/56/wKiom1fvqe7AnB_eAACw02Pf8t0006.jpg "title=" Dis26.jpg "alt=" Wkiom1fvqe7anb_eaacw02pf8t0006.jpg "/> At this time we turn off display_error off and refresh the page again (5,001 php script is a problem).
This opening will expose some of our information, so keep mo off.
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/88/52/wKioL1fvqsjDHrMfAADJGrpbxPw978.jpg "title=" Dis27.jpg "alt=" Wkiol1fvqsjdhrmfaadjgrpbxpw978.jpg "/>
Define the path to our error log:
; error_log = Php_errors.log
; Log errors to Syslog (Event Log on Windows).
; error_log = syslog
----------------------------------------------
Error_log =/usr/local/php/logs/php_errors.log (absolute path of log save)
Exit confirm that this directory does not exist
[Email protected] etc]# Ls/usr/local/php/logs
Ls:cannot access/usr/local/php/logs:no such file or directory #目录不存在
[Email protected] etc]# mkdir/usr/local/php/logs/#创建目录
[Email protected] etc]# chmod 777!$
chmod 777/usr/local/php/logs/# Change the Guangen to 777 to allow Apache to write.
Modify the level from the date
error_reporting = E_all & ~e_notice & ~e_deprecated
[Email protected] ~]# Apachectl Graceful
Refresh the page again, still can't see any relevant interest, but we can view the log.
This helps us not to expose our information, but also to save the error log, to help us troubleshoot problems.
[Email protected] ~]# Cat/usr/local/php/logs/php_errors.log
[01-oct-2016 12:36:37 UTC] PHP Fatal error:directive ' magic_quotes_runtime ' is no longer available in PHP in Unknown on line 0
[01-oct-2016 12:42:55 UTC] PHP Fatal error:directive ' magic_quotes_runtime ' is no longer available in PHP in Unknown on line 0
[01-oct-2016 12:43:17 UTC] PHP Fatal error:directive ' magic_quotes_runtime ' is no longer available in PHP in Unknown on line 0
[01-oct-2016 12:45:36 UTC] PHP Fatal error:directive ' magic_quotes_runtime ' is no longer available in PHP in Unknown on line 0
Split Line ——————————————————————————————————————— Split Line
; Open_basedir = This is a security option,
Configure it to Open_basedir =/data/www2:/tmp
/DATA/WWW2 This is a wrong directory, at this time to visit the site to brush out the white page (ibid. (5,001 php script is a problem).)
Viewing the error log
—————————————————————————————————————————————
did not achieve the desired effect of the experiment, and record it again. I don't understand how this thing is going to be set magic_quotes_runtime.
[Email protected] ~]# Cat/usr/local/php/logs/php_errors.log
[01-oct-2016 12:36:37 UTC] PHP Fatal error:directive ' magic_quotes_runtime ' is no longer available in PHP in Unknown on line 0
[01-oct-2016 12:42:55 UTC] PHP Fatal error:directive ' magic_quotes_runtime ' is no longer available in PHP in Unknown on line 0
[01-oct-2016 12:43:17 UTC] PHP Fatal error:directive ' magic_quotes_runtime ' is no longer available in PHP in Unknown on line 0
[01-oct-2016 12:45:36 UTC] PHP Fatal error:directive ' magic_quotes_runtime ' is no longer available in PHP in Unknown on line 0
[02-oct-2016 06:06:57 UTC] PHP Fatal error:directive ' magic_quotes_runtime ' is no longer available in PHP in Unknown on line 0
[02-oct-2016 06:11:13 UTC] PHP Fatal error:directive ' magic_quotes_runtime ' is no longer available in PHP in Unknown on line 0
—————————————————————————————————————————————
If there are multiple sites on a single server, we
[[email protected] etc]# Vim/usr/local/php/etc/php.ini can not be entered to differentiate the limit.
So you have to do some setup on the virtual machine, a virtual machine with a configuration
[Email protected] ~]# vim/usr/local/apache2/conf/extra/httpd-vhosts.conf
<virtualhost *:80>
DocumentRoot "/data/www"
ServerName www.test.com
Serveralias www.aaa.com
Serveralias www.bbb.com
Php_admin_value open_basedir "/data/www/:/tmp/" #加一句,
The advantage of Apache is that different virtual hosts can be distinguished,
Comment out the directory configuration ([email protected] ~]# Vim/usr/local/php/etc/php.ini)
Then test the Php_admin_value open_basedir "/data/www9/:/tmp/" Directory by mistake
Re-test Open the Web page, the page is not open.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/88/58/wKiom1fwsfSSv7euAADNqOgSwS8718.jpg "title=" Dis28.jpg "alt=" Wkiom1fwsfssv7euaadnqogsws8718.jpg "/>
This article is from the "Cbo#boy_linux Road" blog, make sure to keep this source http://20151213start.blog.51cto.com/9472657/1858386
8_php.ini configuration file Detailed