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

使用dashboard.php和图床软件上传图片无法正常返回链接 #55

Open
qyhfrank opened this issue Oct 21, 2020 · 8 comments
Open

Comments

@qyhfrank
Copy link

qyhfrank commented Oct 21, 2020

在服务器上部署PicUploader,发现默认的sm.ms图床可以正常通过dashboard,picgo或upic上传并返回链接,而s3和minio(其他还没尝试)无法返回链接。具体表现是:

  • dashboard上传:卡在上传中...,但是可以在后台查看到图片已经上传
  • picgo上传:返回{},但是可以在后台查看到图片已经上传
  • upic: response could not be serialized, input data was nil or zero length

记得以前部署的时候没有问题,这次的问题是基于全新部署,希望可以帮忙看一下问题是出在哪里,谢谢啦🙏
此外,文件夹中即使上传了图片貌似也没有出现logs目录?

@xiebruce
Copy link
Owner

xiebruce commented Oct 22, 2020

没有logs目录可能是php没有权限创建目录,你检查一下权限。至于无法上传问题,你直接用命令试试能不能上传,能上传了再来查dashboard的问题,不能就看报什么错

php /path/to/PicUploader/index.php /path/to/test.jpg

另外dashboard里试试把“压缩到原图的”设置为100%,然后把添加水印关掉,然后在dashboard传试试,如果可以,那就是你的php安装的有问题。

@qyhfrank
Copy link
Author

qyhfrank commented Oct 22, 2020

尝试了直接用命令,可以上传,输出markdown格式的链接。把压缩和水印调整后还是无法正常上传。控制台在dashboard.js的103行有如下warning

<br />
<b>Warning</b>:  is_readable(): open_basedir restriction in effect. File(/home/www/.aws/config) is not within the allowed path(s): (/www/wwwroot/PicUploader/:/tmp/) in <b>/www/wwwroot/PicUploader/vendor/aws/aws-sdk-php/src/ClientSideMonitoring/ConfigurationProvider.php</b> on line <b>236</b><br />
{"code":"success","data":{"filename":"image.png","url":"![image.png](https:\/\/xxxx.com\/img\/ab2dc5e5ccc0d01a1127fd3faf2c5097.png)","notFormatUrl":"https:\/\/xxxx.com\/img\/ab2dc5e5ccc0d01a1127fd3faf2c5097.png"}}

@xiebruce
Copy link
Owner

xiebruce commented Oct 22, 2020

应该是权限问题,你的php和nginx的运行用户和组分别是什么?PicUploader的用户和组又是什么?

@qyhfrank
Copy link
Author

image

/www/server/php/73/etc/php-fpm.d/www.conf
image

/www/server/nginx/conf/nginx.conf
image

@xiebruce
Copy link
Owner

看上去没问题呀,你这个报错是往哪个云传的?

<br />
<b>Warning</b>:  is_readable(): open_basedir restriction in effect. File(/home/www/.aws/config) is not within the allowed path(s): (/www/wwwroot/PicUploader/:/tmp/) in <b>/www/wwwroot/PicUploader/vendor/aws/aws-sdk-php/src/ClientSideMonitoring/ConfigurationProvider.php</b> on line <b>236</b><br />
{"code":"success","data":{"filename":"image.png","url":"![image.png](https:\/\/xxxx.com\/img\/ab2dc5e5ccc0d01a1127fd3faf2c5097.png)","notFormatUrl":"https:\/\/xxxx.com\/img\/ab2dc5e5ccc0d01a1127fd3faf2c5097.png"}}

@qyhfrank
Copy link
Author

往s3和minio,都是s3 compatible的,其他的我还没试,要是有必要我可以尝试下腾讯云

@qyhfrank
Copy link
Author

我比较在意那个is_readable的报错,我服务器上也没在那个路径放aws的密匙,上传也只需要我提供在picuploader的密匙就够了吧?

报错看上去连response也准备好了,是什么原因导致无法返回吗?

@xiebruce
Copy link
Owner

不是无法返回,是报错信息混杂在response里,就导致response不是一个json串,不是json当然就无法正常解析出来了,我查查是什么原因吧

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