Open dotherightthing opened 6 years ago
A quick Google for 'bottlenecks WordPress' led me to this post which mentions Blackfire. I've signed up for a free 'Hack' account and followed the installation instructions...
From the installation:
Non Homebrew-PHP users (MacOS X native PHP, MAMP, MAMP Pro, etc)
When using a PHP different than the one shipped with MacOS X, 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
http://localhost/MAMP/index.php?language=English&page=phpinfo
Configuration File (php.ini) Path /Applications/MAMP/bin/php/php5.6.30/conf
https://stackoverflow.com/questions/4145667/how-to-override-the-path-of-php-to-use-the-mamp-path
sudo nano ~/.bash_profile
export PATH="/Applications/MAMP/Library/bin:$PATH"
export MAMP_PHP=/Applications/MAMP/bin/php/php5.6.30/bin
export PATH="$MAMP_PHP:$PATH"
Restart Terminal
Test the changes
which php
/Applications/MAMP/bin/php/php5.6.30/bin/php
Execute the command below replacing 56 by the installed PHP version and follow the instructions in the command output:
brew install blackfire-php56 --without-homebrew-php
Versions are listed here: https://github.com/blackfireio/homebrew-blackfire/tree/master/Formula
brew install blackfire-php56 --without-homebrew-php
==> Caveats To finish installing blackfire for PHP 5.6:
- Add the following lines to php.ini presented by php --ini:
[blackfire] extension="/usr/local/opt/blackfire-php56/blackfire.so" blackfire.agent_socket = unix:///usr/local/var/run/blackfire-agent.sock blackfire.agent_timeout = 0.25 ;blackfire.log_level = 3 ;blackfire.log_file = /tmp/blackfire.log ;blackfire.server_id = ;blackfire.server_token =
php --ini
Configuration File (php.ini) Path: /Applications/MAMP/bin/php/php5.6.30/conf Loaded Configuration File: /Applications/MAMP/bin/php/php5.6.30/conf/php.ini Scan for additional .ini files in: (none)
MAMP > File > Edit Template > PHP (php.ini) > 5.6.30
- Validate installation via one of the following methods:
- Restart your webserver or PHP-fpm.
Restarted MAMP
- Write a PHP page that calls "phpinfo();" ... and look for the info on the "blackfire" module.
php -i | grep blackfire
No info on the "blackfire" module.
Using PHP from the command line:
- Run php --ri blackfire
- If the "blackfire" configuration is displayed, you have been successful!
php --ri blackfire
Extension 'blackfire' not present.
Tried again, moving the blackfire block:
> to here
; DONT REMOVE: MAMP PRO php5.6.30.ini template compatibility version: 10
> from here
Restarted MAMP (had to force quit Apache), still no dice.
Will try again after a restart.
Extension does exist at the specified path:
extension="/usr/local/opt/blackfire-php56/blackfire.so"
;blackfire.log_level = 3 ;blackfire.log_file = /tmp/blackfire.log ;blackfire.server_id = ;blackfire.server_token =
Uncommented these 4 lines, adding my server ID and token as per https://stackoverflow.com/questions/30202276/setting-up-blackfire-io-on-a-mamp-pro-installation-mac-osx#30249897, this didn't help
Restarted Macbook, started MAMP
which php
/Applications/MAMP/bin/php/php5.6.30/bin/php
php --ini
Configuration File (php.ini) Path: /Applications/MAMP/bin/php/php5.6.30/conf Loaded Configuration File: /Applications/MAMP/bin/php/php5.6.30/conf/php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none)
find /usr/local/opt/blackfire-php56/blackfire.so
/usr/local/opt/blackfire-php56/blackfire.so
MAMP > File > Edit Template > PHP (php.ini) > 5.6.30
php --ri blackfire
Extension 'blackfire' not present.
Fixing #150 changed the Query Monitor status from red to orange.
To retry with PHP 7
My local WP LAMP environment is slow to load. Are my plugins contributing to this?