Home  >  Article  >  Backend Development  >  XDebug automatically turns on PHP Stack Trace, causing the PHP Log to exceed 1G_PHP Tutorial

XDebug automatically turns on PHP Stack Trace, causing the PHP Log to exceed 1G_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:30:131174browse

Yesterday morning, I suddenly found that the test server space was full. I used du to check the folders one by one and found that the php debug log occupied a huge area. Some logs were as large as 1G. After opening it, I found an extremely large number of php stack traces.

Go to the main server immediately to check. The main server log is more than 400 MB in size. Fortunately, the main server has enough space.

There are so many stack traces, and I am sure they have not existed before. Checking the logs one by one, they all happened at one time in the morning of a certain day.

Solution:

1. Could it be caused by upgrading php before? I searched the php stack trace on the Internet, and all of them showed how to open it, but not how to close it. After carefully searching for the parameters of PHP, I only found two seemingly related things, ignore_repeated_sources and ignore_repeated_error, which did not work after changing them.

2. If it is not caused by upgrading php, think carefully about what changes have been made in the past few days and which ones are related to php trace. Think of xdebug. First try to delete xdebug. OK, the problem disappears. It must be a problem with xdebug. At the beginning, I didn’t go directly to the official documentation of xdebug. I used phpinfo to type out all the parameters of xdebug. I first guessed which parameter it was. After trying several times, it didn’t work. Then I calmed down and took a look. Take a look at the official documentation of xdebug and found the following words:

Stack Traces

When Xdebug is activated it will show a stack trace whenever PHP decides to show a notice, warning, error etc. The information that stack traces display, and the way how they are presented, can be configured to suit your needs.

If there is something wrong, I continue to search and find a variable "xdebug.default_enable" whose name and purpose you can't figure out. It is really controlled by this parameter, as follows.

xdebug.default_enable

Type: boolean, Default value: 1

If this setting is 1, then stacktraces will be shown by default on an error event. You can disable showing stacktraces from your code withxdebug_disable(). As this is one of the basic functions of Xdebug, it is advisable to leave this setting set to 1. ​ I struggled with this problem for almost a day, and here’s what I learned: Be calm when encountering unexpected problems. Although it affects many of your original plans, if the problem is serious, you must overcome all difficulties and solve it first, otherwise it will form a habit. In addition, when using some ready-made function modules, after searching at the latest to no avail, you have to calm down and read the official documents carefully.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/766187.htmlTechArticleYesterday morning, I suddenly found that the test server space was full. I used du to check the folders one by one and found that the php debug log occupied the space. It’s huge. Some logs are as large as 1G. After opening them, I found an extremely large number of php stacks...
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