PHP configuration sends error logs by email

Source: Internet
Author: User

PHP configuration sends error logs by email

This article mainly introduces how to send error logs by email in PHP configuration (Windows System). This article provides configuration examples and use examples. For more information, see

When a serious problem occurs in the system, it must be immediately sent to the Administrator. You can use error_log () to send errors to your mailbox by email.

Set in php. ini:

The Code is as follows:

Sendmail_from = 472323087@qq.com

Then set:

The Code is as follows:

Sendmail_path = "G: \ sendmail \ sendmail.exe-t"

Where: G: \ sendmail \ sendmail.exe is the mail client address.

Code:

The Code is as follows:

// Disable Error display

Ini_set ('display _ errors ', 0 );

// Enable the error log function

Ini_set ('Log _ errors ', 'on ');

// Display all errors

Error_reporting (-1 );

// Sending Error

Error_log ('the current system is attacked, causing a fatal error', 1, '2017 @ qq.com '); // parameter 1 indicates sending an error by email

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.