WordPress中"无法将上传的文件移动至"错误的解决方法_PHP
今天在网页上传图片到博客,结果提示:“无法将上传的文件移动至 /home/wwwroot/wp-content/uploads/2013/”,郁闷了,认为是权限问题,修改了文件,都改成了777的权限,但是还是不可以写入,图片无法上传。
索性,我查看了我的网站根目录文件夹的权限,显示是www ,www ,而用ps aux|grep nginx 显示的是nobody 的身份运行nginx的子程序,ps aux|grep php-fpm,显示的也是nobody。同时发现,我网站里的其他的文件和文件夹的权限却是root,root。这可能是因为我上次直接用root身份拷贝导致的,所以,无法用nobody的身份修改root的文件。
方法如下:
第一步:
先分别将nginx和php-fpm子程序的运行身份变成www,用户组group也变成www。
修改nginx.conf文件,将user nobody nobody;改成user www www;
运行命令:
service nginx restart //重启nginx
修改php-fpm.conf,将其中的
user = nobody group = nobody
改成:
user = www group =www
运行命令:service php-fpm reload //重启php-fpm
第二步:
修改所有文件夹和文件为www,www
#chown -R www:www /wwwroot
再次上传图片,提示成功上传了,问题解决了。
网上还有一些其他的方法,比如将图片修改成英文名,或者修改文件夹为777。其实很多情况下权限是777了,但是依旧不能上传,可以考虑是不是文件属主的问题。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











There are four ways to adjust the WordPress article list: use theme options, use plugins (such as Post Types Order, WP Post List, Boxy Stuff), use code (add settings in the functions.php file), or modify the WordPress database directly.

To build a website using WordPress hosting, you need to: select a reliable hosting provider. Buy a domain name. Set up a WordPress hosting account. Select a topic. Add pages and articles. Install the plug-in. Customize your website. Publish your website.

Importing WordPress source code requires the following steps: Create a sub-theme for theme modification. Import the source code and overwrite the files in the sub-topic. Activate the sub-theme to make it effective. Test the changes to make sure everything works.

A step-by-step guide to replacing a header image of WordPress: Log in to the WordPress dashboard and navigate to Appearance >Theme. Select the topic you want to edit and click Customize. Open the Theme Options panel and look for the Site Header or Header Image options. Click the Select Image button and upload a new head image. Crop the image and click Save and Crop. Click the Save and Publish button to update the changes.

You can view the WordPress front-end by logging into the dashboard and switching to the View Sites tab; automate the viewing process with a headless browser; installing the WordPress plugin to preview the front-end within the dashboard; viewing the front-end via a local URL (if WordPress is set locally).

WordPress IP blocking plugin selection is crucial. The following types can be considered: based on .htaccess: efficient, but complex operation; database operation: flexible, but low efficiency; firewall: high security performance, but complex configuration; self-written: highest control, but requires more technical level.

To create an account on WordPress, simply visit its website, select the registration option, fill in the registration form, and verify your email address. Other ways to register include using a Google account or Apple ID. The benefits of signing up include creating a website, gaining features, joining the community, and gaining support.

WordPress editing dates can be canceled in three ways: 1. Install the Enable Post Date Disable plug-in; 2. Add code in the functions.php file; 3. Manually edit the post_modified column in the wp_posts table.
