解讀Ubuntu PHP日志信息可以通過以下幾個步驟進行:
通過php.ini配置文件:
error_reporting = E_ALL
display_errors = Off
log_errors = On
log_errors_max_len = 1024
error_log = /var/php_errors.log
使用命令行:
php --ini | grep error_log
<?php
phpinfo();
?>
tail -f 50 /var/php_errors.log
一個典型的日志條目可能如下所示:
[2023-03-03 10:14:32] [error] [client 192.168.1.100] PHP Fatal error: Uncaught Exception: Some specific error message in /var/www/html/index.php:12
Stack trace:
#0 /var/www/html/index.php(12): {main}()
#1 {main}
2023-03-03 10:14:32
error
192.168.1.100
PHP Fatal error: Uncaught Exception: Some specific error message