performance - How to track down slow code in PHP -


i installed open source php project on ubuntu server , got running. however, pages load extremely slow. phpinfo() page , basic test page connecting mysql db load fast. there tons of include files, log files , curl calls in open source code. strategies/tools can use track down source of slowness?

you need profile pages, have performance problems. can done php-extension xdebug , kcachegrind.

follow steps:

  1. install php5-xdebug package on ubuntu server via: sudo apt-get install php5-xdebug.
  2. configure xdebug.profiler_enable_trigger parameter. @ official manual.
  3. install on local computer kcachegrind package: sudo apt-get install kcachegrind.
  4. start slow page get parameter xdebug_profile=1. see related question.
  5. copy generated profile log local comp , open in kcachegrind.

some notes:

  • after php5-xdebug package installation you'll need restart http-server (or php-fpm daemon. depends on installed software on server).
  • right place profiling procedure test environment, not production.

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -