关闭

PHP做服务端给移动端上传图片接口无结果返回

标签: nginxphp
740人阅读 评论(0) 收藏 举报



今儿在做接口的时候,移动端总是说什么结果都没有返回,我觉得就算是错误也应该报错,但是laravel也没有报错,后来有朋友说 是不是我做了什么过滤器,让我试试自己上传图片,我做了个简单的web上传图片后 在本地运行都ok,放在nginx服务器上就报错。 报500错误...



运维同事帮忙解决了 说是 有个缓存目录没有开写的权限 var/lib/nginx/tmp  是根据以下一位网友的博客的情况作为依据解决的,我技术水平不扎实,暂且以为是上传图片的时候也是以流的方式上传,本来不上传图片可能还没什么限制,有了图片后内容过多,无法上传..所以 就会发生如下情况。

今天用CRUL给一个PHP接口POST发送数据时出现500错误,刚开始字符串短没有任何问题,后来换了一篇文章POST过去直接报错了,‘500 Internal Server Error’。
系统: CentOS6.4
web服务:nginx

查看nginx错误日志(/var/log/nginx/error.log)发现以下错误信息。

2014/08/04 15:47:07 [crit] 31212#0: *7 open() "/var/lib/nginx/tmp/client_body/0000000001" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 15:47:36 [crit] 31212#0: *8 open() "/var/lib/nginx/tmp/client_body/0000000002" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 15:47:37 [crit] 31212#0: *9 open() "/var/lib/nginx/tmp/client_body/0000000003" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 15:48:20 [crit] 31212#0: *10 open() "/var/lib/nginx/tmp/client_body/0000000004" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 15:49:04 [crit] 31212#0: *11 open() "/var/lib/nginx/tmp/client_body/0000000005" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 15:49:06 [crit] 31212#0: *12 open() "/var/lib/nginx/tmp/client_body/0000000006" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 15:49:07 [crit] 31212#0: *13 open() "/var/lib/nginx/tmp/client_body/0000000007" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 15:49:08 [crit] 31212#0: *14 open() "/var/lib/nginx/tmp/client_body/0000000008" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 15:49:23 [crit] 31212#0: *17 open() "/var/lib/nginx/tmp/client_body/0000000009" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 15:57:10 [crit] 31212#0: *18 open() "/var/lib/nginx/tmp/client_body/0000000010" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 15:57:15 [crit] 31212#0: *19 open() "/var/lib/nginx/tmp/client_body/0000000011" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 15:57:21 [crit] 31212#0: *20 open() "/var/lib/nginx/tmp/client_body/0000000012" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 15:57:26 [crit] 31212#0: *21 open() "/var/lib/nginx/tmp/client_body/0000000013" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 15:57:32 [crit] 31212#0: *22 open() "/var/lib/nginx/tmp/client_body/0000000014" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 16:01:40 [crit] 32170#0: *1 open() "/var/lib/nginx/tmp/client_body/0000000001" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 16:10:08 [crit] 32170#0: *2 open() "/var/lib/nginx/tmp/client_body/0000000002" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 16:10:12 [crit] 32169#0: *3 open() "/var/lib/nginx/tmp/client_body/0000000003" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 16:10:13 [crit] 32169#0: *4 open() "/var/lib/nginx/tmp/client_body/0000000004" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"
2014/08/04 16:12:26 [crit] 32169#0: *7 open() "/var/lib/nginx/tmp/client_body/0000000005" failed (13: Permission denied), client: 192.168.6.229, server: , request: "POST / HTTP/1.1", host: "192.168.6.73:81"

进到/var/lib目录下查看nginx目录的权限:
drwx------  3 apache  apache  4096 Apr  4 00:30 nginx

执行命令:
chmod -R 775 nginx
问题解决。

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:19454次
    • 积分:298
    • 等级:
    • 排名:千里之外
    • 原创:9篇
    • 转载:12篇
    • 译文:0篇
    • 评论:1条
    文章分类