Platform.sh recommends Blackfire.io. Blackfire is a full continuous observability solution (monitoring, profiling, and automated performance testing tool). It can be used on Integration, Staging, and Production environments. Blackfire supports PHP and Python.
It grants details information on your PHP code’s resources consumption across Wall-Time, CPU, I/O, Memory, Network Calls, HTTP requests and SQL queries.
In addition, it can profile your code automatically and notify you whenever your code does not comply with best practices for PHP, Symfony, Drupal, eZPlatform, Typo3 & Magento code performance management.
For a high level overview and demo of Blackfire, check out the full video tutorial.
Check the latest versions of the probe and CLI tool on Blackfire’s documentation.
Blackfire also offers a perpetually-free edition but it is for local development only and will not run on Platform.sh.
Go to your Dashboard and create a new environment under the Environments tab.
Follow the step-by-step instructions to enable Blackfire on your PHP or Python applications.
Define new Project Variables with your Blackfire Server ID, Server Token, Client ID and Client Token.
env:BLACKFIRE_SERVER_ID = ...
env:BLACKFIRE_SERVER_TOKEN = ...
env:BLACKFIRE_CLIENT_ID = ...
env:BLACKFIRE_CLIENT_TOKEN = ...
Open a support ticket with the Backfire Server ID, Server Token, Client ID, Client Token. Our support team will install it for you.
Note, Blackfire integration works only on profiling your cluster via the URL to the origin. Do not profile your site going through the CDN.
Access your site via your browser and click
Profile in the Blackfire Companion.
That’s it! Your site will be profiled and you should get all the results in your Blackfire account.
To profile your PHP CLI scripts, use the following command line:
blackfire --config /etc/platform/$USER/blackfire.ini <command>
Blackfire also enables you to:
- monitor your applications and get instant and actionable insights on where to look for the most impactful optimization
- collaborate with the rest of your team
- write performance tests
- automate profiling with periodic builds
- integrate further with Platform.sh by enabling to automate profiling as each code commit
- integrate with GitHub, Bitbucket and GitLab to show the results of Blackfire builds at the commit status level
Check Blackfire’s documentation for more information.
Those features may require a Premium or an Enterprise subscription. We offer attractive bundles of Platform.sh and Blackfire.io subscriptions. Please contact our sales department to discuss how we can help you.
Blackfire Monitoring is enabled by default for Monitoring customers.
To disable Blackfire Monitoring, you will need to add the
BLACKFIRE_APM_ENABLED environment variable with a value of
In the management console, view the environment you would like to disable Blackfire Monitoring on and add the variable
env:BLACKFIRE_APM_ENABLED with the value
Otherwise, you can use the CLI command
platform variable:create --level environment --name BLACKFIRE_APM_ENABLED --value 0
If you are using one of those, you will need them to let Blackfire access your servers. More information on how to configure a bypass.
If you are using the HTTP cache with cookies , please update in your
.platform/routes.yaml the cookies that are allowed to go through the cache. You need to allow the
__blackfire cookie name.
cache: enabled: true cookies: ["/SESS.*/", "__blackfire"]
If the above didn’t help, collect the following and send it to the Blackfire support:
- The output of
platform ssh -- php -d display_startup_errors=on --ri blackfirecommand
- The Blackfire logs
Please execute the following in the environment where you’re facing the issue:
platform variable:create php:blackfire.log_file --value /tmp/blackfire.log
platform variable:create php:blackfire.log_level --value 4
- start a profile/build again
You will get the logs with
platform ssh -- cat /tmp/blackfire.log > blackfire.log.
Once you are done, please disable logging with:
platform variable:delete php:blackfire.log_file
platform variable:delete php:blackfire.log_level