所以我跟着these instructions寻找我的流浪汉盒子,一切似乎都很顺利,我是说它在运行。已使用其服务器id和服务器令牌对其进行配置。
然后,我按照同一页上的说明安装了PHP探测,并在安装完成后重新启动了apache2。然后我做了composer require blackfire/php-sdk,最后在我的代码中做了:
$probe = $blackfire->createProbe();
// some PHP code you want to profile
$blackfire->endProbe($probe);
dd('End here.'); // Laravels die and dump function.据我所知,我做的一切都是对的。然后,在我的控制台中,我做到了:
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.嗯..。好的,如果检查日志有问题,那么文档会声明:
vagrant@scotchbox:/var/www$ cat /var/log/blackfire/agent.log
vagrant@scotchbox:/var/www$ 日志里什么都没有...
我做错了什么?
发布于 2016-04-04 23:57:04
不是一个真正的解决方案,而是一个变通的方法,直到我们听到更多关于如何实际解决它的信息。
我直接在代码中手动添加了客户端凭据,它为我解决了这个问题:
$config = new \Blackfire\ClientConfiguration();
$config->setClientId('...your _client_ id...');
$config->setClientToken('...your _client_ token...');
$blackfire = new \Blackfire\Client($config);我在错误中看到的字符串是Authorization: Basic Og==,而Og==只是一个base64编码的字符串:,这暗示用户名/密码(在本例中是id/token?)自动查找失败,无法授权。这就是为什么手动提供细节可以绕过它。
发布于 2018-03-13 22:58:01
有点晚了,但也许将来会有人需要它。将HOME环境变量添加到apache的vhost文件中,以便blackfire找到~/.blackfire.ini来解决这个问题。
<VirtualHost hostname:80>
...
SetEnv HOME /Users/me #i'm running macOS, on linux would be /home/me
...
</VirtualHost>发布于 2019-06-26 02:35:18
考虑到您的探测器配置是正确的(server_id和server_tokens),并且您可以从浏览器进行配置,为了使用PHP SDK (phpunit与blackfire集成),您必须配置客户端:
系统将提示您输入BLACKFIRE_CLIENT_ID和BLACKFIRE_CLIENT_TOKEN。
您还可以登录到此api/v1/collab-tokens以测试您的客户端凭据username=>BLACKFIRE_CLIENT_ID、password=>BLACKFIRE_CLIENT_TOKEN
客户端的配置文件位置:/root/.blackfire.ini
https://stackoverflow.com/questions/35785751
复制相似问题