Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

微信退款证书报错 Unable to set private key file #492

Closed
jianminLee opened this issue Aug 17, 2016 · 3 comments
Closed

微信退款证书报错 Unable to set private key file #492

jianminLee opened this issue Aug 17, 2016 · 3 comments

Comments

@jianminLee
Copy link

jianminLee commented Aug 17, 2016

我用的环境

PHP 版本:5.6
laravel 版本 :5.2
服务器:nginx
overtrue/wechat 版本:3.0

问题及现象

$this->payment->refund()申请退款报错;
证书配置已经设置绝对路径,php已经安装CA证书 ,google一下午也不知所措

报错日志:

Next exception 'GuzzleHttp\Exception\RequestException' with message 'Error creating resource: [message] fopen(): Unable to set private key file `/var/patch/apiclient_cert.pem'
[file] /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
[line] 312
[message] fopen(): failed to create an SSL handle
[file] /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
[line] 312
[message] fopen(): Failed to enable crypto
[file] /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
[line] 312
[message] fopen(https://api.mch.weixin.qq.com/secapi/pay/refund): failed to open stream: operation failed
[file] /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
[line] 312' in /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:51
Stack trace:
#0 /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php(67): GuzzleHttp\Exception\RequestException::wrapException(Object(GuzzleHttp\Psr7\Request), Object(RuntimeException))
#1 /var/www/laravel-titckets/vendor/overtrue/wechat/src/Core/AbstractAPI.php(163): GuzzleHttp\Handler\StreamHandler->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#2 /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php(66): EasyWeChat\Core\AbstractAPI->EasyWeChat\Core{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#3 /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/Middleware.php(132): GuzzleHttp\RetryMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#4 /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(72): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#5 /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/Middleware.php(30): GuzzleHttp\PrepareBodyMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#6 /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php(68): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#7 /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/Middleware.php(59): GuzzleHttp\RedirectMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#8 /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/HandlerStack.php(67): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#9 /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/Client.php(275): GuzzleHttp\HandlerStack->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#10 /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/Client.php(123): GuzzleHttp\Client->transfer(Object(GuzzleHttp\Psr7\Request), Array)
#11 /var/www/laravel-titckets/vendor/guzzlehttp/guzzle/src/Client.php(129): GuzzleHttp\Client->requestAsync('POST', 'https://api.mch...', Array)
#12 /var/www/laravel-titckets/vendor/overtrue/wechat/src/Core/Http.php(228): GuzzleHttp\Client->request('POST', 'https://api.mch...', Array)
#13 /var/www/laravel-titckets/vendor/overtrue/wechat/src/Payment/API.php(396): EasyWeChat\Core\Http->request('https://api.mch...', 'post', Array)
#14 /var/www/laravel-titckets/vendor/overtrue/wechat/src/Payment/API.php(417): EasyWeChat\Payment\API->request('https://api.mch...', Array, 'post', Array)
#15 /var/www/laravel-titckets/vendor/overtrue/wechat/src/Payment/API.php(204): EasyWeChat\Payment\API->safeRequest('https://api.mch...', Array)

@jianminLee
Copy link
Author

解决了 把apiclient_key.pem内容合并到apiclient_cert.pem中就好了

@jkgeekJack
Copy link

@jianminLee 那key的path填什么

@jianminLee
Copy link
Author

@jkgeekJack 还是填apiclient_key.pem php其实用一个就好了 因为公钥和私钥合并成一个文件了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants