Home  >  Article  >  Backend Development  >  How to read php error log

How to read php error log

coldplay.xixi
coldplay.xixiOriginal
2021-03-03 17:59:172344browse

看php错误日志的方法:开启PHP错误日志级别,代码为【ini_set("display_errors", On);ini_set("error_reporting", E_ALL);】。

How to read php error log

本教程操作环境:windows7系统、PHP5.6版,DELL G3电脑。

看php错误日志的方法:

1、通过命令查看服务器上一共开了多少的 php-cgi 进程:

ps -fe |grep "php-fpm"|grep "pool"|wc -l

2、查看FPM在你的机子上的平均内存占用:

ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'

3、指令ps找出消耗内存的元凶

ps -A --sort -rss -o comm,pmem,pcpu |uniq -c |head -15

PHP错误日志

vim /usr/local/php-5.6.5/etc/php.ini
  
display_errors = On
  
error_log = "/data/phplog/error_log"
  
chmod a+w /data/phplog/error_log

开启PHP错误日志级别

ini_set("display_errors", On);
ini_set("error_reporting", E_ALL);

相关视频推荐:PHP视频教程

The above is the detailed content of How to read php error log. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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