Introduction to PHP error log and memory viewing methods (code)

不言
Release: 2023-04-05 16:20:02
forward
2423 people have browsed it

本篇文章给大家带来的内容是关于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
Copy after login

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
Copy after login


开启PHP错误日志级别

ini_set("display_errors", On);
ini_set("error_reporting", E_ALL);
Copy after login

The above is the detailed content of Introduction to PHP error log and memory viewing methods (code). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:csdn.net
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template