Home > Article > Backend Development > Solution to "Unable to move uploaded file to" error in WordPress, wordpress solution_PHP tutorial
Today I uploaded images to the blog on the web page, and the result was: "Unable to move the uploaded file to" The file was moved to /home/wwwroot/wp-content/uploads/2013/". I was depressed. I thought it was a permission issue. I modified the file and changed it to 777 permission, but it still cannot be written and pictures cannot be uploaded.
Simply, I checked the permissions of the root directory folder of my website, and it showed www, www, and using ps aux|grep nginx showed that running the nginx subroutine as nobody, ps aux|grep php-fpm, showed Also nobody. At the same time, I found that the permissions of other files and folders in my website are root, root. This may be caused by the fact that I copied directly as root last time, so I cannot modify root's files as nobody.
Here’s how:
Step one:
First change the running identities of nginx and php-fpm subprograms to www, and the user group group to www.
Modify the nginx.conf file and change user nobody nobody; to user www www;
Run command:
service nginx restart //重启nginx
Modify php-fpm.conf and replace
user = nobody group = nobody
changed to:
user = www group =www
Run command: service php-fpm reload //Restart php-fpm
Step 2:
Modify all folders and files to www, www
#chown -R www:www /wwwroot
Upload the image again, and it will prompt that the upload was successful and the problem is solved.
There are some other methods on the Internet, such as changing the picture to English name, or changing the folder to 777. In fact, in many cases, the permission is 777, but still cannot be uploaded. You can consider whether the file owner is the problem.