laravel CurlFactory.php 第 187 行中的 RequestException
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33908260/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
RequestException in CurlFactory.php line 187
提问by
I'm using Laravel 5.1 and want to send email but I'm getting this error:
我正在使用 Laravel 5.1 并想发送电子邮件,但出现此错误:
RequestException in CurlFactory.php line 187:
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
How could I solve this?
My .env file:
我怎么能解决这个问题?
我的 .env 文件:
MAIL_DRIVER=mailgun
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=oEontENjBIdIrzaXhk9v9Q
My function in controller:
我在控制器中的功能:
public function mailContact(ContactRequest $request)
{
$name = $request->input('name');
$email = $request->input('email');
$body = $request->input('body');
$sent = Mail::send('emails.contact', compact('name', 'email', 'body'), function ($message) {
$message->to('[email protected]', 'Admin')->subject('Message');
});
if ($sent) {
return Redirect::back()->withMessage('???? ?? ????? ???? ??????.');
}
return Redirect::back()->withError('???????? ????? ????? ???.?????? ???? ????');
}
回答by Ancon
- Download the https://gist.github.com/VersatilityWerks/5719158/download
- Extract it an place it in
..\php\ext
(curl.cainfo="E:\xampp\php\ext)" - Open the php.ini and write after the
php_curl.dll
:curl.cainfo="..\php\ext\cacert.pem"(curl.cainfo="E:\xampp\php\ext\cacert.pem")
- Restart the web server.
- 下载https://gist.github.com/VersatilityWerks/5719158/download
- 将其提取到
..\php\ext
(curl.cainfo="E:\xampp\php\ext)" - 打开 php.ini 并写在
php_curl.dll
:curl.cainfo="..\php\ext\cacert.pem"(curl.cainfo="E:\xampp\php\ext\cacert.pem")
- 重新启动 Web 服务器。
回答by Ancon
I added the cacert.pem file as described in http://codeontrack.com/solve-laravelxamppguzzlehttp-curl-error-60-no-sll-certificate/but now I'm getting this error:
我添加了 cacert.pem 文件,如http://codeontrack.com/solve-laravelxamppguzzlehttp-curl-error-60-no-sll-certificate/ 中所述, 但现在我收到此错误:
RequestException in CurlFactory.php line 187:
cURL error 77: error setting certificate verify locations:
CAfile: [pathtothisfile]\cacert.pem
CApath: none (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
CurlFactory.php 第 187 行中的 RequestException:
cURL 错误 77:错误设置证书验证位置:
CAfile:[pathtothisfile]\cacert.pem
CApath:none(参见http://curl.haxx.se/libcurl/c/libcurl-errors。 html)
Any help?
有什么帮助吗?