Configure Blackfire profiler for your php application…!!!

Updated 14 June 2017

What is Blackfire ?

Blackfire is a web app profiler tool that helps you to debug your application & optimize its performance. Once you install & configure it on your server, it will tell you the complete performance of your php app like it will show you the I/O, memory consumption, CPU Time. When you will hit your php app in browser & start profiling your app through blackfire tool, you will get an option “view profile”, just click on that option and get the complete result of your app in which it will visualize you how your app runs & calling php functions step by step. In short i would say, It highlights important pathways so you can focus on the relevant parts of your php app.

Ok now lets install this tool on server…!!!!

Pre-requisites

  • Blackfire Companion is available only on Chrome Browser.
  • Blackfire Agent & client works on Linux, Windows & MacOS X.
  • The Probe works on Linux, Windows & MacOS X with PHP 5.3, 5.4, 5.5, 5.6, and 7.0.

Now i will install it on ubuntu, here are the steps of installation on ubuntu os:-

Register the pagecloud key with the command:-

Add deb http://packages.blackfire.io/debian any main to /etc/apt/sources.list.d/blackfire.list with the command:

now run update command:-

Now install blackfire agent with the command:-

after installation, just register blackfire agent with the command:-

after hitting previous command, It will ask you to enter server id & server token. You will have to generate it by log in or signup your account in its official site.

After log in or sighup, go to the dropdown : click on Account option & here you will get all credentials needed while installation. Get the server id & server token from there and register it.

Now run the command mentioned below to initialize the client:-

After hitting previous command, It will ask you to enter client id & client token. You will get these credentials from the same where you login & got your server id & server token.

Now Install the blackfire php package by hitting:-

After installing blackfire php package. You will need to configure for the PHP probe in your php.ini file placed in /etc/php5/cli/php.ini path.

If you are using php7.0 then your php.ini file will be placed in /etc/php/7.0/cli/php.ini path. If you don’t get your php.ini file in any path mentioned here, go & hit the command to know where it is located by typing:

open your php.ini file (with sudo user) :-

and add the following:-

Now restart your blackfire agent by typing:-

Now go to your chrome browser, search & install Blackfire Companion extension.

After successfully installing the extension, just hit your server’s domain in which you have configured blackfire & then you will get something like:-

Click on Profile:-

After profiling the url of your server. It will display you the summary of your profile.

It will provide you some basic information like:-

388 ms is the time for php to generate the homepage.

6.82 ms is I/O time.

381 ms is the CPU time.

5.44 MB is the amount of memory consumed by PHP.

After that if you click on view profile. You will be redirected to the detailed profile on Blackfire.io.

Your profile page will be look like :-

From here you can check the most time consuming function calls & analyze your complete code which is taking too much time to load.

Note:-

  1. PHP compiled with debug are not supported and that the Probe may conflict with XDebug or XHProf, disable those extensions when enabling the Probe. The Probe conflicts with some PHP extensions like Pinba.
  2. Support for ZTS versions of PHP on MacOS X is currently in beta.

FOR ANY TYPE OF QUERY OR HELP, KINDLY CONTACT US

Tag(s) blackfire php
Category(s) php
author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


2 comments

  • Michael
  • Jimmy
  • Start a Project






      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home