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

原创 2015年11月18日 10:51:45



今儿在做接口的时候,移动端总是说什么结果都没有返回,我觉得就算是错误也应该报错,但是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
问题解决。

mac下 搭建 nginx mysql php运行环境

本来是领导给列出一个文档,重新搭建mnmp,现在把过程重新缕一遍,并把遇到的问题简单记录一下。 1.安装homebrew 打开终端Terminal。在命令行中输入如下命令安装h...

磕磕绊绊配置linux 下 laravel5.1 环境

第二次配置linux下的  laravel 5.1的环境了,第一次迷迷糊糊就配上了,第二次 再来配的时候 什么都没有,什么都不记得了,所以赶紧记录下这次配的所有过程,以备后期再用。 版权声明:本文为博...

android端上传图片到服务端

android端上传图片到服务端! 服务端是用myeclipse写的Servlet。

JavaWeb-1-IOS或Android客户端上传图片到Java服务端存到数据库,再从数据库取出下载下来的过程

前言:一直想写段代码实现IOS或Android客户端上传图片到Java服务端存到数据库,再从数据库取出下载下来的过程,今天终于忍不住将代码吐了出来,这里仅提供了Javaweb端servlet的响应代码...
  • IOT_LI
  • IOT_LI
  • 2015年10月17日 12:01
  • 2958

c/s练习——多个客户端上传图片到服务端(tcp)

我们使用tcp上传图片,设计思路是:服务端一直开着,客户端上传图片,需要给服务端一个图片的路径,在服务端使用客户端的文件名在保存。如果重名,我们就加一个序号。因为图片上传我们使用的是字节流,所有我们先...

web端移动端上传图片,兼容微信

之前的移动端上传的方法,有些朋友测试说微信支持不是很好,还有部分安卓机也不支持,其实我已经有了另一个方法,但是例子还没整理出来,而联系我的很多朋友需要,所以就提前先发出来了,并且做一个简单的说明,就不...

cropper.js 移动端上传图片 并 裁剪 的功能实现

定好页面  效果如图 要求 点击 + 号之后  上传图片  裁剪之后 放在页面上 实现 依赖  remodal 和 cropper.js  把裁剪的内容 放在remodal里  点击 ...

移动端上传图片时弹窗浏览并删除JQUERY+CSS3

移动端上传图片时弹窗浏览并删除JQUERY+CSS3移动端上传图片时弹窗浏览并删除JQUERY+CSS3 * { margin: 0px; padding: 0px; -webkit-tap-hig...

移动端上传图片弹窗浏览并删除特效

* { margin: 0px; padding: 0px; -webkit-tap-highlight-color: rgba(255, 255, 255, 0); box-sizing:borde...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:PHP做服务端给移动端上传图片接口无结果返回
举报原因:
原因补充:

(最多只允许输入30个字)