Debugging and Slowness with Php

  1. Install : Xdebug 

Can be done by install then entering the following :  /etc/php/7.1/fpm/php.ini:

zend_extension = /usr/lib/php/20160303/
xdebug.profiler_enable = 0
xdebug.profiler_output_name = cachegrind.out.%t
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = /tmp
xdebug.profiler_enable_trigger_value = "<super secret key>"

In order, the configuration goes as follows: load the module, disable profiling be default, set the filename, enable triggering via GET/POST parameter, output in /tmp and only profile when given the key.

Restart php-fpm and you should be good to go.

2) Use the ?XDEBUG_PROFILE=<super secret key> appended to any page you want to debug and the debug file will be put in /tmp.

3) Open the debug file using something like :  For Analysis specifically for reducing 

Invocation Count is how many times that function was called. A simple tip for reducing this is to pull out any repetitive function calls from a for-loop into a single variable.

 Total Self Cost is the total percentage or time that the function is responsible for. You can improve this by reducing code complexity, using built-in native functions or removing unused variables.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: debug, PHP, profile, slowness, xdebug

Trackback from your site.