On Wed, Aug 28, 2013 at 12:18 PM, Merrill Oveson <[email protected]> wrote:
> Everything was running fine and then suddenly on Monday, site starts to > consume 100% of the cpu and memory, causing the site to time out for users. > For this kind of error, I usually install the XDebug extension for PHP. Then I setup php.ini (or another script in the php.d/ directory, if your distro supports it) with xdebug.profiler_enable=1, and then restart the web server. Then, go to a page and add a GET/POST or COOKIE variable of the name XDEBUG_PROFILE (with a non-zero value), and that creates a profile (usually in the /tmp directory, but that too can be controlled in the php.ini settings). Last but not least, run that profile file through either WebGrind (a web application) or WinCacheGrind (if you run Windows) or KCacheGrind (for KDE) or XCallGraph (Java). They'll give you lots of fancy output about which functions were called, which functions are taking all of the CPU and memory, etc. I find it to be an invaluable tool for debugging PHP errors of all kinds... more information at http://www.xdebug.org/docs/profiler -- Jared Smith _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
