1

I am experiencing the following issue when uploading a file via phpMyAdmin, MODx or Wordpress. In the PHP application itself I am receiving a success message but the file is not uploaded. The nginx error.log prints the following messages:

[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...

I am running CentOS Linux release 7.2.1511 (Core) with Nginx 1.8.0 and PHP 5.4.16. This setup was working before updating from CentOS 7.1 to 7.2.

Here are the steps that I already tried to solve the problem:

  • sys_get_temp_dir() -> /tmp
  • /tmp has permissions 1777
  • PHP is running as user nginx
  • it is plenty of free disk space available
  • post_max_size, upload_max_filesize and client_max_body_size are all set to 50m

I am running out of ideas...

Thanks in advance

1 Answer 1

2

Simple Solution:

$ sudo systemctl restart php-fpm nginx

Fixed the problem. I don't know why, but now it is working like a charm.

Sign up to request clarification or add additional context in comments.

1 Comment

It's almost certain somebody has deleted the directory that's created in the /tmp area for both these processes nginx and php-fpm to write to. The processes then attempt to write to a non-existent directory. Restarting them recreates the directories and which makes it work again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.