How to setup zend profiler to log queries

So basically, I am working on a php project which is using Zend Framework 1. I had to profile all the queries for several pages to check whether the page being rendered were optimised.

So here’s how it was done:

First you need to install the Firebug extension for google chrome (I am using google chrome).

https://chrome.google.com/webstore/detail/firephp4chrome/gpgbmonepdpnacijbbdijfbecmgoojma

Secondly, use the Zend_Db_Profile_Firebug class.

$profiler = new Zend_Db_Profiler_Firebug(‘All DB Queries’);
$profiler->setEnabled(true);

$this->getFrontController()->getParam(‘bootstrap’)->getPluginResource(‘multidb’)->getDb(‘database_name’)->setProfiler($profiler);

The last line setups the profiler for a specific database if you have more than one database, else you could simply use getDb()->setProfiler($profiler);

Facebook Comments

Oct, 10, 2016

  Zend

0

SHARE THIS