Installing Blackfire

Discover our Public Cloud offer

Shared Hosting for Everyone, imagined by developers, for developers.

Discovering the Public Cloud

Blackfire helps to test, debug optimize applications. It offers agents in a number of languages and here we will present the steps needed to install the PHP and Python agents.

In our example, we use the SSH access and consider the following information:

  • Account name: foo
  • Blackfire directory: $HOME/blackfire/

[foo], <version>, [version], <YOUR_SERVER_ID> and <YOUR_SERVER_TOKEN> must be replaced by accurate informations.

Step 1: Agent download

foo@ssh:~/blackfire$ wget https://packages.blackfire.io/debian/pool/any/main/b/blackfire-php/blackfire-agent_<version>_amd64.deb
foo@ssh:~/blackfire$ dpkg -x blackfire-agent_<version>_amd64.deb .

Download page: take the DEB 64 bits package.

Step 2: Agent configuration

foo@ssh:~/blackfire$ cat << EOF > etc/blackfire/agent-prod
[blackfire]
; setting: server-id
; You can find your personal server-id at https://blackfire.io/my/settings/credentials
server-id=<YOUR_SERVER_ID>

; setting: server-token
; You can find your personal server-token at https://blackfire.io/my/settings/credentials
server-token=<YOUR_SERVER_TOKEN>

; setting: log-file
log-file=/home/[foo]/blackfire/agent.log

; setting: log-level
; desc   : log verbosity level (4: debug, 3: info, 2: warning, 1: error)
; default: 1
log-level=1

; setting: memory-limit
; desc   : Sets the maximum allowed RAM usage (megabytes) when ingesting traces. Use 0 to disable
; default: 500
memory-limit=500

EOF

More options are available on their documentation.

Step 3: Daemon start

Create a service with the following details:

  • Command: /home/[foo]/blackfire/usr/bin/blackfire --config=/home/[foo]/blackfire/etc/blackfire/agent-prod
  • Working directory: /home/[foo]/blackfire

Step 4: Probes installation

PHP

Download

foo@ssh:~/blackfire$ wget https://packages.blackfire.io/debian/pool/any/main/b/blackfire-php/blackfire-php_<version>_amd64.deb
foo@ssh:~/blackfire$ dpkg -x blackfire-php_<version>_amd64.deb .

Download page - point D: take the DEB 64 bits package.

php.ini modification (Environment > PHP)

extension = /home/[foo]/blackfire/usr/lib/blackfire-php/amd64/blackfire-[version].so

More options are available on their documentation. To set up logs:

blackfire.log_level = 1
# Log verbosity level (4: debug, 3: info, 2: warning, 1: error)
blackfire.log_file = /home/[foo]/blackfire/blackfire-php.log

Python

foo@ssh:~$ python -m pip install blackfire