Get your Blackfire credentials
The account owner has access to the Blackfire credentials for your project. Contact the account owner for more information.
Enable the Blackfire integration
We recommend you enable the Blackfire integration in an environment (that is, branch). You can optionally merge the environment with its parent after you know it’s working.
To enable Blackfire:
- Log in to the machine on which your SSH keys are stored.
Log in to your Magento Enterprise Cloud Edition project.
List environments in the project:
magento-cloud environment:list -p <project ID>
See what branch you’re currently in, if any.
If necessary, check out an existing branch:
magento-cloud environment:checkout <environment ID>
You can also create a new branch using the
Back up the environment using a snapshot:
magento-cloud snapshot:create -e <environment ID>
- Use a text editor to open
<project root dir>/.magento.app.yaml.
Add the following to the
- name: blackfire configuration: server_id: "<blackfire Server ID>" server_token: "<blackfire Server token>"
<blackfire Server ID>and
<blackfire Server token>to the values from your Blackfire account.
runtime: extensions: - mcrypt - redis - xsl - json - name: blackfire configuration: server_id: "<blackfire Server ID>" server_token: "<blackfire Server token>"
- Save your changes to
.magento.app.yamland exit the text editor.
Add, commit, and push your changes to the environment:
git add -A git commit -m "<message>" git push origin
If errors display during deployment, open
.magento.app.yamland check the syntax. Check indentation and spelling and try again.
Verify it’s working
To verify Blackfire works, you can SSH to the environment and run a command as follows:
- Log in to the Web UI.
- In the right pane, click the name of your environment.
- Hover the mouse pointer over Access site.
Copy the SSH access URL to the clipboard as the following figure shows.
- Enter that command in your terminal window to log in using SSH.
Enter the following command:
php --ri blackfire
A sample result follows:
blackfire Blackfire => enabled Blackfire => 1.10.3 Timing measurement => cgt Num of CPU => 8 Profiling heap memory => 0 Kb Main instance trigger mode => HTTP header triggered Main instance => enabled Main instance info Output stream => file Signature validated => no EnvId validated => no Fully decoded => no Directive => Local Value => Master Value blackfire.agent_socket => tcp://blackfire.platform.sh:8307 => tcp://blackfire.platform.sh:8307 blackfire.agent_timeout => 10 => 10 blackfire.env_id => no value => no value blackfire.env_token => no value => no value blackfire.log_level => 1 => 1 blackfire.log_file => no value => no value
Profile your site
To start profiling your site using Blackfire:
Install the Blackfire.io Companion browser plug-in for your browser.
For example, to install the Chrome Companion, see Blackfire.io documentation.
Use the Web UI to find the Web access URL for your environment as the following figure shows:
- Go to your site using Chrome.
- In the upper right corner of the Chrome window, click .
Follow the prompts on your screen to set up a comparison, then click Profile! as the following figure shows.
Using Blackfire is beyond the scope of this guide. For more information, see one of the following resources: