0

A large third-party PHP application is taking a very long time (multiple seconds) to process a certain POST request. I need to find out what is taking so long.

In the Java land, taking a few thread dumps would often (not always) tell you where the program is stuck. Can I do something similar in PHP?

The debug_backtrace() function would not help in this situation, because I so not have a specific place in the PHP code where I would put debug_backtrace() call. Instead, I want PHP code to start executing, then dump a stack trace approximately 2 seconds into execution.

1 Answer 1

2

I would recommend you take a look at xdebug and doing proper profiling: http://www.xdebug.org/docs/profiler

You'll be able to generate a dump of all method calls in your application, which includes execution time. You can then load and analyse them with KCacheGrind/WinCacheGrind.

Sign up to request clarification or add additional context in comments.

1 Comment

There should be a tick to the left of my post under the voting buttons.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.