xiebruce / PicUploader

一个还不错的图床工具,支持Mac/Win/Linux服务器、支持压缩后上传、添加图片或文字水印、多文件同时上传、同时上传到多个云、右击任意文件上传、快捷键上传剪贴板截图、Web版上传、支持作为Mweb/Typora发布图片接口、作为PicGo/ShareX/uPic等的自定义图床,支持在服务器上部署作为图床接口,支持上传任意格式文件。
https://www.xiebruce.top/17.html
MIT License
1.19k stars 169 forks source link

帮我看下错误 #16

Closed xhmily closed 5 years ago

xhmily commented 5 years ago

Fatal error: Uncaught GuzzleHttp\Exception\RequestException: cURL error 77: error setting certificate verify locations: CAfile: ‪C:\phpStudy\PHPTutorial\php\php-7.2.1-nts\cacert.pem CApath: none (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in C:\phpStudy\PHPTutorial\WWW\PicUploader\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:186 Stack trace:

0 C:\phpStudy\PHPTutorial\WWW\PicUploader\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(149): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array)

1 C:\phpStudy\PHPTutorial\WWW\PicUploader\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(102): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))

2 C:\phpStudy\PHPTutorial\WWW\PicUploader\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\ in C:\phpStudy\PHPTutorial\WWW\PicUploader\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 186

xiebruce commented 5 years ago

在我博客文档中页内搜索“在使用微博/Imgur/Github/smms做图床时,可能会有以下报错”,里面有说。

xhmily commented 5 years ago

正是因为我照做了,所以报错是 77 而不是 60 啊

xiebruce commented 5 years ago

你用的哪个云?

xhmily commented 5 years ago

github

xiebruce commented 5 years ago

你有科学上网工具吗?设置个代理试试,有可能是这问题,不要认为你直接能访问github就一定不需要科学上网,你先试试。

xhmily commented 5 years ago

我把工具开全局也是报这个错

xiebruce commented 5 years ago

不要用全局,php内部发起的curl请求貌似不会走全局的,还是在配置里设置吧,具体看config:

'proxy' => 'http://127.0.0.1:1087',

其中1087不一定是1087,要看你自己的端口

xhmily commented 5 years ago

不行,还是这样,不过我发现个问题,把Apache关掉也是这个错误,是不是我环境哪里错了

xiebruce commented 5 years ago

你是怎么上传?右击上传吗?右击上传跟apache没关系的

xhmily commented 5 years ago

哦哦,我就是右击上传,那我到底哪一步错了

xhmily commented 5 years ago

仓库用手动创建Images文件夹吗

xiebruce commented 5 years ago

不用手动创建的,你手动创建也可以

xhmily commented 5 years ago

搞了一天了,就是报错

xiebruce commented 5 years ago

你确定这个文件存在吗?C:\phpStudy\PHPTutorial\php\php-7.2.1-nts\cacert.pem ? 还有把你那个php.ini文件填curl.cainfo=部分截图给我看看。

xhmily commented 5 years ago

image image d都存在的

xiebruce commented 5 years ago

引号不是中文引号吧?

xhmily commented 5 years ago

肯定是英文的,我是学java的,这点会注意的,现在又开始报新错了 ,似乎环境没问题了,你看看

Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: PUT https://api.github.com/repos/xhmily/imgbed/contents/images/c26297c9820bf57e7277acfd37d0f769.jpg resulted in a 404 Not Found response: { "message": "Not Found", "documentation_url": "https://developer.github.com/v3/repos/contents/#create-or-update-a-f (truncated...) in F:\PicUploader\PicUploader\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php:113 Stack trace:

0 F:\PicUploader\PicUploader\vendor\guzzlehttp\guzzle\src\Middleware.php(66): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))

1 F:\PicUploader\PicUploader\vendor\guzzlehttp\promises\src\Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response))

2 F:\PicUploader\PicUploader\vendor\guzzlehttp\promises\src\Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)

3 F:\PicUploader\PicUploader\vendor\guzzlehttp\promises\src\Task in F:\PicUploader\PicUploader\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 113

xiebruce commented 5 years ago

这次就不是证书错误了,不过你这错误不应该呀,你那个路径我对比了一下,应该没问题呀,你现在没用代理了吧?如果有用的话,把配置的代理去掉,把全局代理也关掉再试试

xhmily commented 5 years ago

没用代理,都关掉了 github.com/xhmily/imgbed 这是我仓库 头疼了

xiebruce commented 5 years ago

你试试手动创建一个images文件夹,再来上传(但实际上是不需要手动创建的,不过还是试试吧)

xhmily commented 5 years ago

创建了也是不行

xiebruce commented 5 years ago

那就神奇了,你找到这个文件uploader/UploadGithub.php,然后添加一个输出:

$uri = $this->repo . '/contents/'. $key;
var_export($uri);exit;

然后再上传试试输出什么?

xhmily commented 5 years ago

可是加在哪行

xiebruce commented 5 years ago

这行是添加的var_export($uri);exit;,这行是原来的$uri = $this->repo . '/contents/'. $key;,你只要找到原来那行,在它下面添加就行,在90多行

xhmily commented 5 years ago

输出这个 'xhmily/imgbed/contents/images/81cfc40a15185398d0b46a62538a7dd1.jpg'

xiebruce commented 5 years ago

好,添加那行去掉吧,或者用//注释掉,我先看看是怎么回事

xiebruce commented 5 years ago

把你PicUploader里配置github的那个配置截图给我看看,access_token你模糊一下就行,其他参数不是什么敏感参数

xhmily commented 5 years ago

image

xiebruce commented 5 years ago

你的网页版有没有配置起来?现在要确定一下,配置读的是哪个配置,如果你用了网页版的,那它会读网页版的那个配置,如果没有用网页版,它会读config-local.php,如果没有config-local.php,它会读config.php,你现在这个是哪个文件?

xhmily commented 5 years ago

网页版没弄,Apache都没启动,现在是config-local.php配置了 ,源文件没改动

xiebruce commented 5 years ago

有没可能是token权限问题?不过如果token权限貌似也不应该报这错呀,你能不能把token给我用一下试试?发上来也没事,反正你可以删掉重新生成一个,不过等我试完你再删。

xhmily commented 5 years ago

5d35af23054bcf044c3d670a692b9eb8e7092c4e 去试吧

xiebruce commented 5 years ago

果然我用你的不行,应该就是token权限问题了,我的token权限这样的,你按我这弄试试: image

xiebruce commented 5 years ago

最新测试,只要这几个权限就够了,不需要其它(我现在也把其它权限去掉了): image

xiebruce commented 5 years ago

怎么样,可以了不?

xhmily commented 5 years ago

按照你的权限重新生成,然后这是结果.....

Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: PUT https://api.github.com/repos/xhmily/imgbed/contents/images/e28f1bcf7ba255c58c055d0c647d9289.jpg resulted in a 401 Unauthorized response: { "message": "Bad credentials", "documentation_url": "https://developer.github.com/v3" }

in F:\PicUploader\PicUploader\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php:113 Stack trace:

0 F:\PicUploader\PicUploader\vendor\guzzlehttp\guzzle\src\Middleware.php(66): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))

1 F:\PicUploader\PicUploader\vendor\guzzlehttp\promises\src\Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response))

2 F:\PicUploader\PicUploader\vendor\guzzlehttp\promises\src\Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)

3 F:\PicUploader\PicUploader\vendor\guzzlehttp\promises\src\TaskQueue.php(47): GuzzleHttp\Promise\Promi in F:\PicUploader\PicUploader\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 113

xiebruce commented 5 years ago

那你就加权限,先全部勾上,看行不行,行了再慢慢减吧,这401就是权限问题

xhmily commented 5 years ago

Automata.jpg

好了非常感谢,还是所有权限最保险,star了

xiebruce commented 5 years ago

好的谢谢,终于可以了,不过现在我还是没明白,你的cainfo证书那个报错,是怎么好的?自己好的还是你之前填错了什么?

xhmily commented 5 years ago

没有填错,可能是重新填过一次,不清楚,明明操作一样,文件也还是昨晚下载的那个,只是今天重新复制了一下路径而已啊

xiebruce commented 5 years ago

那我怀疑还是路径的问题,可能某个小错误你没发现,例如一个空格或者一个隐藏的什么符号,有时候很诡异的,毕竟你这错误就是报的“error setting certificate verify locations”: image

xhmily commented 5 years ago

可能是这样

xiebruce commented 5 years ago

嗯,不管怎样,反正现在可以了哈哈,网页版搞起来,修改配置会比较方便,我更新了一下,添加了对Cloudinary的支持!

xhmily commented 5 years ago

嗯,不过那些杂七杂八的容器不敢用,指不定哪天图片没了或者公司倒了,反正我只用腾讯阿里GitHub

xiebruce commented 5 years ago

我这个PicUploader是可以同时上传多个的,不太可能好几个一起倒闭。

xhmily commented 5 years ago

反正GitHub最稳,话说这样正常吗 image image

xiebruce commented 5 years ago

这不正常啊,应该替换成年月日才对,我查查我这里吧,刚才我试的时候还没问题的

xhmily commented 5 years ago

对啊,我也是按照你博客填的,是不是还有其他设置

xiebruce commented 5 years ago

你在这文件settings/SettingController.php里添加一句:

var_export($storageTypes[$key]['directory']);exit;

添加的位置: image

然后上传一下,看打印出来的值。


如果没打印出来(也就是没进if),那么在if前面添加这句:

var_export($storageTypes[$key]['directory']);exit;

image 同样,上传一下看打印出什么值。

xhmily commented 5 years ago

还是这样,没有输出