通过phpMyAdmin、MODx或Wordpress上传文件时遇到以下问题。在PHP应用程序本身中,我收到了一条成功消息,但文件没有上传。nginxerror.log打印以下消息:
[warn][..] a client request body is buffered to a temporary file...
FastCGI sent in stderr: "PHP message: PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0...
我运行的是带有Nginx 1.8.0和PHP 5.4.16的CentOSLinux版本7.2.1511(Core)。此安装程序在从CentOS 7.1更新到7.2之前可以正常工作。
以下是我已经尝试解决问题的步骤:
- sys_get_temp_dir()->/tmp
- /tmp具有权限1777
- PHP以用户nginx的身份运行
- 有足够的可用磁盘空间
- post_max_size、upload_max_filesize和client_max_body_size都设置为50m
我没什么想法了。。。
提前感谢
简单解决方案:
$ sudo systemctl restart php-fpm nginx
修复了问题。我不知道为什么,但现在它就像一个魅力。