Home > Backend Development > PHP Tutorial > How to configure PHP to send error logs by email_PHP tutorial

How to configure PHP to send error logs by email_PHP tutorial

WBOY
Release: 2016-07-13 09:49:12
Original
1000 people have browsed it

How to configure PHP to send error logs by email

This article mainly introduces how to configure PHP to send error logs by email (Windows system). This article gives Configuration examples and usage examples, friends in need can refer to it

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:

The code is as follows:

sendmail_from = 472323087@qq.com

Then set:

The code is as follows:

sendmail_path = "G:sendmailsendmail.exe -t"

Where: G:sendmailsendmail.exe is the address of the email client.

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/1020272.htmlTechArticlePHP configuration method to send error logs by email This article mainly introduces PHP configuration to send error logs by email Sending method (Windows system), this article gives configuration examples and usage...
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