我有以下代码发出Guzzle 4.1请求:
$client = new \GuzzleHttp\Client(['defaults/headers/User-Agent' => $userAgentString]);
$retry = 0;
do {
try {
return $client->post($url, $options);
} catch (\Exception $e) {
echo $e->getMessage();
$retry++;
continue;
}
} while ($retry < 3);
它运行了很长一段时间,但随机间隔,有时会出现cURL CA文件的问题,导致由于未捕获的异常而导致致命错误。我不确定我能否做到这一点,因为我已经在try catch
区块内进行了此操作。
以下是解决我的Laravel控制台命令的错误:
cURL error 77: error setting certificate verify locations:
CAfile: /home/vagrant/Projects/test.dev/laravel/vendor/guzzlehttp/guzzle/src/cacert.pem
CApath: /etc/ssl/certs (0)
PHP Fatal error: Uncaught exception 'ErrorException' with message 'include(/home/vagrant/Projects/test.dev/laravel/vendor/filp/whoops/src/Whoops/Exception/Inspector.php): failed to open stream: Too many open files' in /home/vagrant/Projects/test.dev/laravel/vendor/composer/ClassLoader.php:382
我想做的不仅是弄清楚Guzzle为什么会出现这个cURL错误,而且如果它出现在其他有这个cURL问题的系统中我怎么能抓住它,所以它不会崩溃这个过程。