真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

Linux 無法寫入權(quán)限問題 | Wordpress 不能自動安裝主題、插件

折騰好 Wordpress,開始安裝插件了,結(jié)果直接報錯

香河網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)公司,香河網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為香河近千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站制作要多少錢,請找那個售后服務(wù)好的香河做網(wǎng)站的公司定做!

Installation failed: Could not create directory

當(dāng)時站點(diǎn)健康工具(Site Health)里的文件系統(tǒng)權(quán)限(Filesystem Permissions) 全是 Not Writable

搜了一圈,這篇文章解決了我的問題:

Linux無法寫入權(quán)限問題 & 解決Wordpress不能自動安裝主題、插件
Author:flymorn Source:飄易

正 文:
當(dāng)你的wordpress遇到以下問題時:

  1. 不能上傳圖片
  2. 不能自動安裝主題、插件(需要FTP賬戶)
  3. 不能自動更新
  4. 其它任何需要wordpress寫文件的問題

這些問題基本都是一個原因,你的wordpress目錄不屬于當(dāng)前的用戶和組,即web訪問的用戶沒有權(quán)限操作wp的一切需要寫權(quán)限的操作,其實(shí)就是linux下權(quán)限不足,無法寫入造成的。

解決方法:

首先需要你有root權(quán)限,SSH登錄,進(jìn)入到wp的安裝目錄:

cd /var/www/html/my_wp_blog

給予所有的寫權(quán)限:

chmod 777 wp-content

接下來給你的博客的文章上傳一張圖片,WP會生成一個目錄,然后查看是哪個用戶創(chuàng)建了文件夾。一般情況下,這個用戶名叫“apache”,也有不少人發(fā)現(xiàn)這個用戶是“nobody”,就飄易本身遇到的問題,我在VPS上安裝的是LNmp,這個用戶是“www”。

進(jìn)入到wp的wp-content目錄,查看該目錄下所有文件/文件夾的權(quán)限,所屬用戶、用戶組:

cd wp-content
ls -l
total 16
-rw-r–r– 1 root root   30 May  4  2007 index.php
drwxr-xr-x 3 root root 4096 Feb 10 19:31 plugins
drwxr-xr-x 5 root root 4096 Mar 23 03:04 themes
drwxrwxrwx 3 www www 4096 Mar 24 02:08 uploads

注意上傳目錄 uploads 是用戶 www 創(chuàng)建的。
接下來把wp-content權(quán)限還原到 755::

cd ..
chmod 755 wp-content

下來就是實(shí)際修復(fù)的命令了,改變wp所在文件夾的擁有者為剛找到的這個用戶www:

cd ..
chown -R www:www my_wp_blog

備注:補(bǔ)充以另外一種查找當(dāng)前用戶和組的名稱的方法:
打開:

/usr/local/php/etc/php-fpm.conf

里面有 user和group項(xiàng),看他們的值是什么,如下圖:

Linux無法寫入權(quán)限問題 & 解決Wordpress不能自動安裝主題、插件
OK,問題解決了。下面是英文的原文:

There are a wide variety of problem reports appearing on support forums related to Wordpress that all have one root cause and solution. Here are some common issue descriptions:

  • Problems uploading images
  • Problems installing themes, plugins
  • Problems auto-upgrading Wordpress
  • Anything else where Wordpress needs to write files

And here is a typical error message:

“To perform the requested action, connection information is required.” Or…
“Unable to create directory [...]. Is its parent directory writable by the server?”

The problem is that Wordpress is executing in the context of your web server process, but the directories have write permissions based on the user context used to originally create the directories.

Many of the suggested solutions on the web simply won’t work, while other solutions work but create security problems with your Wordpress installation. Here is the full solution that should work on all Linux systems, regardless of the specific environment.

What we are going to do is give your web server ownership of the directories and files of your Wordpress install. This requires you to be knowledgeable and comfortable in your bash shell environment, which is probably reasonably true if you installed Wordpress yourself.

First we will give everybody write access so that WP can write the content directories. Some solutions on the web stop at this step, but this leaves your files with no filesystem security. We are only doing this briefly in order to determine what user context is being used by the web server.

Go to your Wordpress root directory:

cd /var/www/html/my_wp_blog

Give the world write access to the content directory:

chmod 777 wp-content

Now log into Wordpress and upload a photo to a blog post, causing WP to create the new directories required. Then look on the server to see what user created the directories. This would commonly be apache, but also many people are reporting that this is the user “nobody” on their server.

cd wp-content
ls -l

total 16
-rw-r–r– 1 root root   30 May  4  2007 index.php
drwxr-xr-x 3 root root 4096 Feb 10 19:31 plugins
drwxr-xr-x 5 root root 4096 Mar 23 03:04 themes
drwxrwxrwx 3 apache apache 4096 Mar 24 02:08 uploads

Notice that the uploads directory was created by user apache:apache. This is the information you needed. Go back down one dir level and set the permissions back to a secure level.

# cd ..
# chmod 755 wp-content

Now for the actual fix. Recursively set the owner and group for your Wordpress installation to the user that created the uploads directory.

# cd ..
# chown -R apache:apache my_wp_blog

You’re done. Wordpress now has access to the file system for photo and attachment uploads, automatic upgrades, and anything else needed by your plugins.


文章題目:Linux 無法寫入權(quán)限問題 | Wordpress 不能自動安裝主題、插件
網(wǎng)站網(wǎng)址:http://weahome.cn/article/dsoihcc.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部