Skip to content

Instantly share code, notes, and snippets.

@dotherightthing
Last active March 21, 2020 09:08
Show Gist options
  • Save dotherightthing/9683fd621c3a678711b3b68d092f5eaa to your computer and use it in GitHub Desktop.
Save dotherightthing/9683fd621c3a678711b3b68d092f5eaa to your computer and use it in GitHub Desktop.
[Blackfire.io setup] #php #mamp #performance

Blackfire.io setup

A. Configure Homebrew - OK

B. Install the Packages - OK

C. Configure the Agent - OK

D. Install the PHP Probe (MacOS)

https://blackfire.io/docs/up-and-running/installation?action=install&mode=full&location=local&os=darwin&language=php&agent=e9b417bc-c155-45bc-b995-f850f822962a

Attempt 1

When using a PHP different than the one shipped with macOS, please ensure the php binary from your PATH is the one you want to use Blackfire on. For example if you are using MAMP, when you run which php, the path returned should mention MAMP.

which php
# /usr/bin/php
  1. nano ~/.bash_profile
  2. export PATH=/Applications/MAMP/bin/php/php7.4.2/bin:$PATH
  3. source ~/.bash_profile
which php
# /Applications/MAMP/bin/php/php7.4.2/bin/php

echo $PATH

PATH contains PHP 7.4.2

Then https://blog.liplex.de/blackfire-setup-with-mamp-pro/

brew install blackfire-php74 --without-homebrew-php

Error: Version of PHP (73) in $PATH does not support this extension version (74). Consider installing blackfire-php-73 with the --without-homebrew-php flag.

brew install blackfire-php73 --without-homebrew-php

Create phpinfo() in info.php in WordPress site root (local dev only) - Blackfire extension does not appear..

Tried:

# destination path can be found via phpinfo() - extension_dir
cp blackfire.so /Applications/MAMP/bin/php/php7.4.2/lib/php/extensions/no-debug-non-zts-20190902/blackfire.so

MAMP > PHP > Make this version available on the command line: check

php --ri blackfire # Extension 'blackfire' not present.

Attempt 2

Change MAMP's default version of PHP to 7.3.9

Update the php.ini file as instructed by Blackfire in the console output from brew install

php --ri blackfire # Extension 'blackfire' not present.

But phpinfo() shows:

blackfire
Blackfire	enabled
Blackfire	1.31.0~mac-x64-non_zts73
Timing measurement	cgt
Sessions support	enabled
Num of CPU	12
Profiling heap memory	0 Kb
Main instance trigger mode	HTTP header triggered
Main instance	disabled

Run Chrome Blackfire extension on local website (logged out of WP Admin).

Profiler graph generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment