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
问题解决。

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

PHP 写app上传图片接口

我是用本机做的服务器,简单的实现了一下图片上传的功能,所以路径都是基于本机,大家可以只看思路: public function UpHeardimage() { if (isse...

PHP post 接口上传图片 [接收ios ||androip 两种接收图片数据流保存图片方式]

// 保存会员头像             if ($apiType != 'ios') {          ...

android上传图片到PHP后台全过程

PS:便宜的服务器可是会不定时的坑你一把。      今天在修改app的一些交互以及重构代码。一切都是那么顺利,啪啪啪,runing,测试没问题,再啪啪啪。。。 突然,测试上传头像的时候,老是连接超时...

open() "/usr/local/nginx/nginx-1.8.1/client_body_temp/0000000297" failed (13: Permission denied),

这两天遇到项目中APP调用后台接口时,接口调不通,尝试将APP端URL直接换成IP形式也调不通,于是查看nginx的日志,查看nginx/nginx-1.8.1/logs下的error.log如下:2...

移动端网页如何使用JqueryMobile+PHP实现上传图片的功能

首先,实现上传功能。上传功能是利用PHP实现的: 创建一个文件上传表单 01   02   ...

Nginx 上传不了,只能上传1M内文件

一、修改nginx目录下的nginx.conf 默认是8m,改为1000m 二、修改项目配置的conf,在location内增加client_max_body_size为100m ...

php HTTP请求类,支持GET,POST,Multipart/form-data

PHP HttpRequest class, HTTP请求类,支持GET,POST,Multipart/form-data HttpRequest.class.php <?php /** HttpR...

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

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

android端上传图片到服务端

android端上传图片到服务端! 服务端是用myeclipse写的Servlet。
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

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