report errors
[ERROR] cURL error 1014: SSL verify failed (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://mgobe.tencentcloudapi.com/[247] in /www/wwwroot/*.net/vendor/
[ERROR] #0 /www/wwwroot/tencentgame.net/vendor/tencentcloud/tencentcloud-sdk-php/src/TencentCloud/Common/AbstractClient.php(175): TencentCloud\Common\AbstractClient->doRequestWithOptions()
#1 /www/wwwroot/*.net/app/Controller/IndexController.php(46): TencentCloud\Common\AbstractClient->__call()
#2 /www/wwwroot/*.net/vendor/hyperf/http-server/src/CoreMiddleware.php(161): App\Controller\IndexController->index()
#3 /www/wwwroot/*.net/vendor/hyperf/http-server/src/CoreMiddleware.php(113): Hyperf\HttpServer\CoreMiddleware->handleFound()
frame
hyperf swoole 4.5. 9 openssl1. one point one
direction
1. System layer. The OpenSSL version of swoole is too low. PHP — RI swoole view OpenSSL version is 1.0 1. The system checks that the OpenSSL version is 1.1 1 upgrade the OpenSSL version of swoole. Recompile (not working)
2. Framework issues
The hyperf framework spoole adopts the co process mode, and guzzle will cause blocking and error reporting
use GuzzleHttp\Client;
use Hyperf\Guzzle\CoroutineHandler;
use GuzzleHttp\HandlerStack;
$client = new Client([
'base_uri' => 'http://127.0.0.1:8080',
'handler' => HandlerStack::create(new CoroutineHandler()),
'timeout' => 5,
'swoole' => [
'timeout' => 10,
'socket_buffer_size' => 1024 * 1024 * 2,
],
]);
$response = $client->get('/');
1. Add handler at the request => Handlerstack:: create (New coroutinehandler()) to solve the problem
2. Directly use hyperf\ guzzle\coroutinehandler as the processor and set it in the guzzle client to turn it into collaborative operation. In order to facilitate the creation of guzzle objects for collaborative processes, we provide a factory class hyperf\guzzle\clientfactory to facilitate the creation of clients
<?php
use Hyperf\Guzzle\ClientFactory;
class Foo {
/**
* @var \Hyperf\Guzzle\ClientFactory
*/
private $clientFactory;
public function __construct(ClientFactory $clientFactory)
{
$this->clientFactory = $clientFactory;
}
public function bar()
{
// $options is equivalent to the $config parameter of the GuzzleHttp\Client constructor
$options = [];
// $client is a coroutineized GuzzleHttp\Client object
$client = $this->clientFactory->create($options);
}
}