Home >Database >Mysql Tutorial >How to check the logs of IIS, PHP and MySQL
1. IIS log
Open IIS, find the website, right-click and select "Properties" and find the "Website Home Directory" option Card.
In the "Log file" column, select "Daily" or "Maximum file" as the log method.
To view the log, you can view the path of the log file in "Website Properties" - "Log File".
2. PHP log
You can use the following function to open the error log in PHP:
ini_set('error_log', 'C:/path/to/php-error.log'); // 将错误日志打印到指定文件中 ini_set('log_errors', true); // 开启错误日志 error_reporting(-1); // 输出所有错误信息
It is recommended to Error logs are printed to separate files for easier viewing. To view the error log, you can directly open it through the file path.
3. MySQL logs
MySQL logs are divided into error logs, warning logs, slow query logs and binary logs. They can be enabled through the following command line operations:
Error log:
Add the following configuration to the MySQL configuration file to enable the error log:
log_error=/path/to/mysql-error.log
Among them /path/to/mysql-error.log
is the error log path.
Warning log:
Add the following configuration to the MySQL configuration file to enable the warning log:
log_warnings=2
where2
is the warning level.
Slow query log:
Add the following configuration to the MySQL configuration file to enable the slow query log:
slow_query_log=1 slow_query_log_file=/path/to/mysql-slow.log
Among them /path/to/mysql-slow.log
is the slow query log path.
Binary log:
Add the following configuration to the MySQL configuration file to enable binary log:
log-bin=/path/to/mysql-bin
where/path/to/mysql-bin
is the binary log path.
The above is the detailed content of How to check the logs of IIS, PHP and MySQL. For more information, please follow other related articles on the PHP Chinese website!