Blackfire is a PHP profiler. To get it run you need the agent and the probe. The probe is a PHP extensions that gathers all the data of the request. The agent is a daemon that is running on your system and processes the data of the probe and sends it to blackfire.io, where the data is then visualized.
I created two AUR packages: one for the agent and one for the PHP extension. You can find both PKGBUILDs in my GitHub repo.
For the agent you need to simply install the blackfire-agent
package from AUR. It will prompt you the remaining steps you need to do:
You need to configure your Blackfire credentials via: sudo -u blackfire-agent blackfire-agent -register
This will prompt you for the missing information (server-id and server-token) which you can look up once you have logged into your blackfire.io account.
The agent comes with a systemd service file. So you can simply start the agent with following command:
$ sudo systemctl start blackfire-agent
If you wish you can also enable it to start the agent on each boot:
$ sudo systemctl enable blackfire-agent
That’s all for the agent!
The PHP extension can be installed with the AUR package php-blackfire
. It comes with a default config in /etc/php/conf.d/blackfire.ini
. There you also need to specify the server id and the server token and uncomment the line
extension="/usr/lib/php/modules/blackfire.so"
Keep in mind that this extension can interfere with the XDebug and XHProf extension. Therefore those should be disabled.
Then simply restart the webserver or the PHP-FPM service.
The easiest way to invoke the profile run is by installing the Chrome/Chromium browser extension. Click on the icon in the browser toolbar, select the slot and click “Profile”. That’s it!
Now run it on all your PHP pages and improve their performance! ;)