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
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:
<? Php
// 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
,