Closed xhmily closed 5 years ago
正是因为我照做了,所以报错是 77 而不是 60 啊
你用的哪个云?
github
你有科学上网工具吗?设置个代理试试,有可能是这问题,不要认为你直接能访问github就一定不需要科学上网,你先试试。
我把工具开全局也是报这个错
不要用全局,php内部发起的curl请求貌似不会走全局的,还是在配置里设置吧,具体看config:
'proxy' => 'http://127.0.0.1:1087',
其中1087不一定是1087,要看你自己的端口
不行,还是这样,不过我发现个问题,把Apache关掉也是这个错误,是不是我环境哪里错了
你是怎么上传?右击上传吗?右击上传跟apache没关系的
哦哦,我就是右击上传,那我到底哪一步错了
仓库用手动创建Images文件夹吗
不用手动创建的,你手动创建也可以
搞了一天了,就是报错
你确定这个文件存在吗?C:\phpStudy\PHPTutorial\php\php-7.2.1-nts\cacert.pem
?
还有把你那个php.ini文件填curl.cainfo=
部分截图给我看看。
d都存在的
引号不是中文引号吧?
肯定是英文的,我是学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:
这次就不是证书错误了,不过你这错误不应该呀,你那个路径我对比了一下,应该没问题呀,你现在没用代理了吧?如果有用的话,把配置的代理去掉,把全局代理也关掉再试试
没用代理,都关掉了 github.com/xhmily/imgbed 这是我仓库 头疼了
你试试手动创建一个images文件夹,再来上传(但实际上是不需要手动创建的,不过还是试试吧)
创建了也是不行
那就神奇了,你找到这个文件uploader/UploadGithub.php
,然后添加一个输出:
$uri = $this->repo . '/contents/'. $key;
var_export($uri);exit;
然后再上传试试输出什么?
可是加在哪行
这行是添加的var_export($uri);exit;
,这行是原来的$uri = $this->repo . '/contents/'. $key;
,你只要找到原来那行,在它下面添加就行,在90多行
输出这个 'xhmily/imgbed/contents/images/81cfc40a15185398d0b46a62538a7dd1.jpg'
好,添加那行去掉吧,或者用//
注释掉,我先看看是怎么回事
把你PicUploader里配置github的那个配置截图给我看看,access_token你模糊一下就行,其他参数不是什么敏感参数
你的网页版有没有配置起来?现在要确定一下,配置读的是哪个配置,如果你用了网页版的,那它会读网页版的那个配置,如果没有用网页版,它会读config-local.php
,如果没有config-local.php
,它会读config.php
,你现在这个是哪个文件?
网页版没弄,Apache都没启动,现在是config-local.php配置了 ,源文件没改动
有没可能是token权限问题?不过如果token权限貌似也不应该报这错呀,你能不能把token给我用一下试试?发上来也没事,反正你可以删掉重新生成一个,不过等我试完你再删。
5d35af23054bcf044c3d670a692b9eb8e7092c4e 去试吧
果然我用你的不行,应该就是token权限问题了,我的token权限这样的,你按我这弄试试:
最新测试,只要这几个权限就够了,不需要其它(我现在也把其它权限去掉了):
怎么样,可以了不?
按照你的权限重新生成,然后这是结果.....
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:
那你就加权限,先全部勾上,看行不行,行了再慢慢减吧,这401就是权限问题
好了非常感谢,还是所有权限最保险,star了
好的谢谢,终于可以了,不过现在我还是没明白,你的cainfo证书那个报错,是怎么好的?自己好的还是你之前填错了什么?
没有填错,可能是重新填过一次,不清楚,明明操作一样,文件也还是昨晚下载的那个,只是今天重新复制了一下路径而已啊
那我怀疑还是路径的问题,可能某个小错误你没发现,例如一个空格或者一个隐藏的什么符号,有时候很诡异的,毕竟你这错误就是报的“error setting certificate verify locations”:
可能是这样
嗯,不管怎样,反正现在可以了哈哈,网页版搞起来,修改配置会比较方便,我更新了一下,添加了对Cloudinary的支持!
嗯,不过那些杂七杂八的容器不敢用,指不定哪天图片没了或者公司倒了,反正我只用腾讯阿里GitHub
我这个PicUploader是可以同时上传多个的,不太可能好几个一起倒闭。
反正GitHub最稳,话说这样正常吗
这不正常啊,应该替换成年月日才对,我查查我这里吧,刚才我试的时候还没问题的
对啊,我也是按照你博客填的,是不是还有其他设置
你在这文件settings/SettingController.php
里添加一句:
var_export($storageTypes[$key]['directory']);exit;
添加的位置:
然后上传一下,看打印出来的值。
如果没打印出来(也就是没进if),那么在if前面添加这句:
var_export($storageTypes[$key]['directory']);exit;
同样,上传一下看打印出什么值。
还是这样,没有输出
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