Reputation: 12923
So I followed these instructions for my vagrant box and everything seemed to go fine, I mean its running. It has been configured with its server id and server token.
I then installed the PHP Probe, as per the instructions on the same page and restarted apache2 when it was done. I then did composer require
blackfire/php-sdk
and finally in my code I did:
$probe = $blackfire->createProbe();
// some PHP code you want to profile
$blackfire->endProbe($probe);
dd('End here.'); // Laravels die and dump function.
So as far as I know I did everything right. Then, in my console I did:
vagrant@scotchbox:/var/www$ php artisan fetch_eve_online_region_type_history_information
[Blackfire\Exception\ApiException]
401: while calling GET https://blackfire.io/api/v1/collab-tokens [context: NULL] [headers: array (
0 => 'Authorization: Basic xxxxxx=',
1 => 'X-Blackfire-User-Agent: Blackfire PHP SDK/1.0',
)]
// where xxxx is some kind of authentication token that looks different from what I gave as my server id and token.
uh .... Ok so the docs state if something goes wrong to check the logs:
vagrant@scotchbox:/var/www$ cat /var/log/blackfire/agent.log
vagrant@scotchbox:/var/www$
Theres nothing in the logs....
What am I doing wrong?
Upvotes: 3
Views: 6802
Reputation: 1
consider that your probe configuration is correct (server_id & server_tokens) and you can profile from the browser , for using PHP SDK (phpunit integration with blackfire) you have to configure the client side :
apt-get install blackfire-agent
blackfire config
you will prompt for BLACKFIRE_CLIENT_ID and BLACKFIRE_CLIENT_TOKEN .
you can also login to this api/v1/collab-tokens to test your client credentials username=>BLACKFIRE_CLIENT_ID , password=>BLACKFIRE_CLIENT_TOKEN
the config file location for the client : /root/.blackfire.ini
Upvotes: 0
Reputation: 13
A little bit late but maybe someone will need it in the future. Adding the HOME environment variable to apache's vhost file so blackfire finds ~/.blackfire.ini solves it.
<VirtualHost hostname:80>
...
SetEnv HOME /Users/me #i'm running macOS, on linux would be /home/me
...
</VirtualHost>
Upvotes: 1
Reputation: 3485
Not a real solution, but rather a workaround until we hear more about how to actually solve it.
I have added the client credentials manually directly in the code and it solved the issue for me:
$config = new \Blackfire\ClientConfiguration();
$config->setClientId('...your _client_ id...');
$config->setClientToken('...your _client_ token...');
$blackfire = new \Blackfire\Client($config);
The string that I saw in the error was Authorization: Basic Og==
and Og==
is just a base64-encoded string :
, which hints that username/password (or id/token in this case?) automatic lookup failed and authorization is impossible. That's why providing the details manually works around it.
Upvotes: 14