PHP configuration method to send error logs by email (Windows system), php log_PHP tutorial

WBOY
Release: 2016-07-13 09:48:46
Original
997 people have browsed it

PHP configuration method to send error logs by email (Windows system), php logs

When a serious problem occurs in the system, it needs to be sent to the administrator immediately. Errors can be emailed to the mailbox via error_log().

Set in php.ini:
Copy code The code is as follows:
sendmail_from = 472323087@qq.com

Then set:
Copy code The code is as follows:
sendmail_path = "G:sendmailsendmail.exe -t"

Among them: G:sendmailsendmail.exe is the address of the mail client.

Code:

Copy code The code is as follows:
//Close error display
ini_set('display_errors', 0);
//Enable error log function
ini_set('log_errors', 'on');
//Show all errors
error_reporting(-1);

//Sending error
error_log('The current system is under attack and a fatal error occurred', 1, '472323087@qq.com'); //Parameter 1 means sending the error by email

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1021090.htmlTechArticlePHP configuration method to send error logs by email (Windows system), PHP logs when a serious event occurs in the system The problem needs to be sent to the administrator immediately. You can pass error_log() to...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!