magento web developer

Manchester based Magento and Zend Framework certified developer.

Installing XHProf on Magento

Installing XHProf on ubuntu is quite easy using the following commands:

sudo pecl install xhprof-beta

Add the following to the end of /etc/php5/conf.d/xhprof.ini (you will need to create it):


Programming for fun with Project Euler

Looking back, most of the code I wrote in 2013 was for Magento, or some other PHP project that in the end would be delivered to a client for their approval (.. or disapproval :( !) This year I intend to spend more time programming recreationally. Coding without a deadline often allows you to spend more time exploring concepts that are too risky for you to ordinarily explore. For example, I think that an understanding of C is such a crucial skill (especially if you do PHP) that it needs to be given the time of day even if you cannot find a commercial medium for it. The biggest problem with all of this is, well, what do I code? This is where Project Euler comes in.

Returning HTML with ajax and layout handles

Not so long ago, when I wanted to serve HTML via ajax, my controller action would look something like this:

$myBlock = $this->getLayout()


However I have since discovered a much better way that is not ignorant to layout handles. With a module/controller/method with layout handle mymodule_index_index you can rewrite the node named ‘root’ as follows:


    <block type="core/template" name="root" output="toHtml" template="mymodule/index.phtml" />


Using XHProf for Magento profiling

Built by facebook, XHProf is a “function-level hierarchical profiler for PHP and has a simple HTML based user interface”. With Magento being a very big platform with a lot going on, it is often useful to determine where time is being spent. Of course there are fantastic tools like NewRelic, however if you are not willing to pay, or you are on a shared server, then XHProf does the job.

Fortunately, there is already a good Magento module available for XHProf available at Liip provide a fairly solid integration of XHProf into the Magento admin panel, the only thing left to be desired is perhaps a better graphical user interface. It shows a break down of time spent in each method allowing you to diagnose why a given request is taking so long.

Recently I used this and discovered that I had not configured sendmail correctly!

EDIT: I’ve posted a follow up post on how to install XHProf and set it up with Magento.

1 2