Closed txl263 closed 4 years ago
log目录里有日志
咦,配置里'logPath' => 'desktop',但是桌面没有,然后也没有logs目录
没有logs目录就是没权限创建,你是什么系统?
忘了说了 MACOS catalina
你是右击上传吗?没有logs目录,那就是没有权限生成,把整个目录的权限改成你当前用户应该就行了,假设你的用户名叫zhangsan
,那么可以用这个命令:chown -R zhangsan:staff ./PicUploader
,但是要先cd
进入到PicUploader所在的目录中
不好意思,昨天点的预览,我还以为发出去了,今天看才发现我只是预览。
这个东西不要应该,要确认,你直接看下,现在PicUploader目录的所有者和所属组,ls -l | grep PicUploader
就能看,比如我的所有者就是bruce
(即我的用户名)和staff
(用户的文件所属组一般都是staff
)
嗯嗯 确认权限没问题
total 400
drwxr-xr-x 20 Eric staff 680B 12 10 22:35 .
drwxr-xr-x 4 Eric staff 136B 12 10 22:11 ..
-rw-r--r--@ 1 Eric staff 8.0K 12 10 22:37 .DS_Store
drwxr-xr-x 12 Eric staff 408B 12 10 22:48 .git
-rw-r--r-- 1 Eric staff 662B 12 10 20:23 .gitignore
-rw-r--r-- 1 Eric staff 1.0K 12 10 20:23 LICENSE
-rw-r--r-- 1 Eric staff 6.1K 12 10 20:23 README.md
drwxr-xr-x 5 Eric staff 170B 12 10 20:23 accessorys
drwxr-xr-x 3 Eric staff 102B 12 10 20:23 common
-rw-r--r-- 1 Eric staff 680B 12 10 20:23 composer.json
-rw-r--r-- 1 Eric staff 87K 12 10 20:23 composer.lock
drwxr-xr-x 5 Eric staff 170B 12 10 20:50 config
-rw-r--r-- 1 Eric staff 2.7K 12 10 20:23 dashboard.php
-rw-r--r-- 1 Eric staff 66K 12 10 20:23 favicon.ico
-rw-r--r-- 1 Eric staff 6.1K 12 10 20:23 index.php
drwxr-xr-x 12 Eric staff 408B 12 10 20:23 settings
drwxr-xr-x 11 Eric staff 374B 12 10 20:23 static
drwxr-xr-x 5 Eric staff 170B 12 10 20:23 thirdpart
drwxr-xr-x 28 Eric staff 952B 12 10 20:23 uploader
drwxr-xr-x 32 Eric staff 1.1K 12 10 20:23 vendor
那你点上传后,那个转动的齿轮消失后,你有没有试着粘贴一下,看能粘贴出什么内容不?
第一句就说啦,返回的是空的。 话说,我觉得是不是PHP的问题。 装Chevereto的时候就搞不定目录的权限问题。。。。后来干脆下了docker。。。
哦,我知道问题了,你把index.php
里的第一句error_reporting(0);
注释掉,就会报错了,忘了屏蔽了错误。
有报错,就知道问题出在哪儿了
define("KS3_API_LOG",FALSE);这个也得改吧
这个不用啊,你就注释我说的那句,然后再试着右键上传,然后应该就有logs目录了,然后你去里面看看是什么报错,或者你粘贴出来有可能也有错误
还是没有呢
那只能调试代码了,我也猜不出哪儿有问题了,你方便的话,我可以远程帮你调调看,用teamviewer,直接把id和密码在这回复上来,我连上后,再删掉就行
我自己去看看代码先,搞不定再问你。谢谢啊
好的,不客气!或者,你可以试试上传到github,或者其它的地方,看行不行,我试了一下,我这边上传到Chevereto是没问题的。对了,你php是什么版本?要用7.0以上的,不然不行的
我用的7.2
好,我先试试别的图床
嗯,那就不是php版本问题
注释掉index.php里的第一句error_reporting(0);后,上传完成后,粘贴链接会出现如下信息
Notice: Undefined index: useOriginalName in /Users/xxxx/workspace/software/PicUploader/uploader/UploadCloudinary.php on line 48
Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /Users/xxx/workspace/software/PicUploader/vendor/cloudinary/cloudinary_php/src/Cloudinary.php on line 529
Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /Users/xxx/workspace/software/PicUploader/vendor/cloudinary/cloudinary_php/src/Cloudinary.php on line 567
@xiebruce
@ncepuwanghui 你是不是用了老的config.php文件?(如果你以前用着,后来我更新了,但是你没有更新这个文件,就会有这个问题),你试试拿最新的config.php文件复制到config-local.php里,再重新修改你要修改的参数,再试试
@ncepuwanghui 你是不是用了老的config.php文件?(如果你以前用着,后来我更新了,但是你没有更新这个文件,就会有这个问题),你试试拿最新的config.php文件复制到config-local.php里,再重新修改你要修改的参数,再试试
没有,我pull的最新的master分支代码,只注释了index.php中error_reporting(0);这一行。
@ncepuwanghui 不好意思,确实是我这边的问题,已修复,你更新一下就可以了
@ncepuwanghui 不好意思,确实是我这边的问题,已修复,你更新一下就可以了
客气了,非常感谢分享,已经可以正常使用了
@ncepuwanghui 好的
你好, 我也是自建的Chevereto图床, 按doc配置后, Mac上右键上传后报错:
2020-01-14 00:24:14 (Chevereto) => Client error: POST http://pic.ysoph.pp.ua/api/1/upload
resulted in a 400 Bad Request
response:
{"status_code":400,"error":{"message":{},"code":false,"context":null},"status_txt":"Bad Request"}
请问这是什么原因啊? 我在想是跟我网站开了强制HTTPS有关系嘛?
@Yakatosh 你自己直接在你的chevereto图床里可以正常上传吗?
可以的, 而且就是同一张图片
@Yakatosh 我这里试是没问题的,你的chevereto是最新的吗?我用的应该不是最新的,另外你知道怎么看版本吗?我没找到在哪个地方看版本,有可能你是最新的有问题吧,我待会试试更新一下是不是因为新版本的问题,但我感觉新版本应该是更新功能而不会去修改接口呀
我用的是最新的1.1.4版本的Chevereto Free。看版本的话, 打开它的Dashboard就能看到了 好的, 麻烦你了! 虽然我也觉得应该不是这个问题...
@Yakatosh 我更新到1.1.4了,没问题,我这里还是正常,你再确认一下,你的accessKey填的对不对,感觉这个跟是否为https无关,我试了http和https都没问题。
另外你可以参考一下我的nginx配置:
server {
listen 80;
listen 443;
server_name chevereto.xxxxx.com;
client_header_timeout 60s;
client_body_timeout 60s;
send_timeout 60s;
keepalive_timeout 65s;
access_log /var/log/nginx/chevereto.xxxxx.com.acess.log combined;
error_log /var/log/nginx/chevereto.xxxxx.com.error.log error;
root /data/wwwroot/Chevereto/;
#https start
ssl_certificate /usr/local/nginx/letsencrypt/chevereto.xxxxx.com/fullchain.pem;
ssl_certificate_key /usr/local/nginx/letsencrypt/chevereto.xxxxx.com/private.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHellA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
#https end
location ~* /install/.*$ {
index installer.php;
#return 502 "this is a test";
try_files /app/$uri /app/$uri/ /app/install/installer.php?$query_string;
}
## CORS headers
location ~* /.*\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js) {
add_header Access-Control-Allow-Origin "*";
}
## Upload path for image content only and set 404 replacement
location ^~ /images/ {
location ~* (jpe?g|png|gif) {
log_not_found off;
error_page 404 /Chevereto/content/images/system/default/404.gif;
}
}
## Pretty URLs
location / {
index index.php;
try_files $uri $uri/ /index.php?$query_string;
}
# END Chevereto nginx rules
location ~ \.php$ {
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
}
谢谢了, 找到问题了...Chevereto API调用是视为游客的。而我在设置里把模式设置为private, 只有注册用户才能用....把private改成public就可以用了。难怪每次都干脆的 Bad Request
@Yakatosh 好的,解决了就好
怎么debug呢,用Chevereto自建的图床,没有上传成功,也没有返回错误