所以我按照我的流浪盒子的这些说明,一切似乎都很顺利,我的意思是它正在运行。它已经配置了它的服务器 ID 和服务器令牌。
然后我按照同一页面上的说明安装了 PHP Probe,并在完成后重新启动了 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.
Run Code Online (Sandbox Code Playgroud)
所以据我所知,我做的一切都是正确的。然后,在我的控制台中,我做了:
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.
Run Code Online (Sandbox Code Playgroud)
呃.... 好的,所以文档说明是否出现问题以检查日志:
vagrant@scotchbox:/var/www$ cat /var/log/blackfire/agent.log
vagrant@scotchbox:/var/www$
Run Code Online (Sandbox Code Playgroud)
日志里什么都没有....
我究竟做错了什么?
mki*_*nas 12
不是一个真正的解决方案,而是一个解决方法,直到我们听到更多关于如何实际解决它的信息。
我直接在代码中手动添加了客户端凭据,它为我解决了这个问题:
$config = new \Blackfire\ClientConfiguration();
$config->setClientId('...your _client_ id...');
$config->setClientToken('...your _client_ token...');
$blackfire = new \Blackfire\Client($config);
Run Code Online (Sandbox Code Playgroud)
在错误我看到的是字符串Authorization: Basic Og==和Og==仅仅是一个base64编码字符串:,这暗示,用户名/密码(或ID /在这种情况下,令牌?)自动查找失败和授权是不可能的。这就是为什么手动提供详细信息可以解决它。