Solution to the error "unable to move uploaded files to" in WordPress _ PHP-php Tutorial

Source: Internet
Author: User
Tags nginx server
This article mainly introduces how WordPress cannot move uploaded files to an error. the environment in this article is based on the Linux system and Nginx server, if you want to upload images to a blog today, you can refer to the following message: "You cannot move the uploaded file to/home/wwwroot/wp-content/uploads/2013 /", depressed, I think it is a permission issue. I changed all my files to 777 permissions, but I still cannot write them, and images cannot be uploaded.
Simply, I checked the permissions of the root directory folder of my website, and the permissions are www and www, while ps aux | grep nginx displays the nginx subroutine running as nobody, ps aux | grep php-fpm, also displays nobody. At the same time, I found that the permissions for other files and folders on my website are root and root. This may be because I copied the file directly as the root user last time. Therefore, the root file cannot be modified as the nobody user.
The method is as follows:
Step 1:
First, the running identities of nginx and php-fpm subprograms are changed to www, and the user group is also changed to www.
Modify the nginx. conf file and change user nobody to user www;
Run the following command:

Service nginx restart // restart nginx

Modify the php-fpm.conf

  user = nobody  group = nobody

Changed:

  user = www  group =www

Run the 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, prompting you that the upload is successful and the problem is fixed.
There are also some other methods on the Internet, such as changing the image to the English name or the folder to 777. In fact, in many cases, the permission is 777, but it still cannot be uploaded. you can consider whether it is the file owner.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.