WordPress: Changing File Permissions:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
无编辑摘要
无编辑摘要
第7行: 第7行:
* <code>/wp-admin/</code>-WordPress 管理区域:所有的文件只有你的用户账户才可以写。
* <code>/wp-admin/</code>-WordPress 管理区域:所有的文件只有你的用户账户才可以写。
* <code>/wp-includes/</code> - WordPress应用逻辑的大部分:所有的文件只有你的用户账户才可以写。
* <code>/wp-includes/</code> - WordPress应用逻辑的大部分:所有的文件只有你的用户账户才可以写。
* <code>/wp-images/</code> - image files used by WordPress: all files should be writable only by your user account.
* <code>/wp-images/</code> - WordPress 使用的图像文件:所有的文件只有你的用户账户才可以使用。
* <code>/wp-content/</code> - variable user-supplied content
** <code>/wp-content/themes/</code> - 主题文件。如果你想使用内置的主题编辑器,所有的文件需要集合起来而且是可写的。如果你不想使用内置的编辑器,所有的文件只有你的用户账户才可以写。
** <code>/wp-content/themes/</code> - theme files.  If you want to use the built-in theme editor, all files need to be group writable.  If you do not want to use the built-in theme editor, all files can be writable only by your user account
** <code>/wp-content/plugins/</code> - 插件文件:所有的文件只有你的用户账户才可以使用。
** <code>/wp-content/plugins/</code> - plugin files: all files should be writable only by your user account.
** code>/wp-content/</code>下面的其它目录应该由任何需要它们的插件/主题记录。权限会有不同。
** other directories under <code>/wp-content/</code> should be documented by whatever plugin / theme requires them.  Permissions will vary.
** The WordPress数据库文件备份插件需要<code>/wp-content/</code> 文件夹可写。在有些情况下,这可能需要上交755个权限或者更多,(例如有些主机上777个权限)。
** The WordPress Database Backup Plugin requires the <code>/wp-content/</code> folder be made writeable. In some cases, this may require assigning 755 permissions or higher (e.g. 777 on some hosts).
在这个论坛 thread上也可以看看这方面的讨论.


Also see the discussion in this [http://wordpress.org/support/topic/50863|Support Forum thread].


== Using an FTP Client ==
== 使用一个FTP帐户 ==


FTP programs ("clients") allow you to set permissions for files and directories on your remote host. This function is often called <code>chmod</code> or <code>set permissions</code> in the program menu.
FTP programs ("clients") allow you to set permissions for files and directories on your remote host. This function is often called <code>chmod</code> or <code>set permissions</code> in the program menu.
 
FTP程序(“客户”)允许你为你的远程主机上的文件和目录设置权限. 这个功能通常称为chmod或者在程序菜单上设定权限.
In a [[WordPress:Installing_WordPress|WordPress install]], two files that you will probably want to alter are the index page, and the css which controls [[WordPress:Blog_Design_and_Layout|the layout]]. Here's how you change index.php - the process is the same for any file.
In a [[WordPress:Installing_WordPress|WordPress install]], two files that you will probably want to alter are the index page, and the css which controls [[WordPress:Blog_Design_and_Layout|the layout]]. Here's how you change index.php - the process is the same for any file.
In the screenshot below, look at the last column - that shows the permissions. It looks a bit confusing, but for now just note the sequence of letters.
In the screenshot below, look at the last column - that shows the permissions. It looks a bit confusing, but for now just note the sequence of letters.

2008年3月26日 (三) 13:45的版本

在电脑文件系统中,不同的文件和不同的目录有权限规定谁和什么东西可以编辑和阅读它们。这很重要因为WordPress也许需要有权限在你的wp-content上写文件以确保一些特别的功能。

下面是一个可能的权限方案。 所有的文件应该由你的用户账户拥有,而且可以由你写。任何需要来自WordPress写权限的文件,应该由网络服务器使用的用户账户集体拥有。

  • 根WordPress目录:所有的文件只有你的用户账户才可以使用。
    • .htaccess 之外,如果你想WordPress为你自动产生重写功能
  • /wp-admin/-WordPress 管理区域:所有的文件只有你的用户账户才可以写。
  • /wp-includes/ - WordPress应用逻辑的大部分:所有的文件只有你的用户账户才可以写。
  • /wp-images/ - WordPress 使用的图像文件:所有的文件只有你的用户账户才可以使用。
    • /wp-content/themes/ - 主题文件。如果你想使用内置的主题编辑器,所有的文件需要集合起来而且是可写的。如果你不想使用内置的编辑器,所有的文件只有你的用户账户才可以写。
    • /wp-content/plugins/ - 插件文件:所有的文件只有你的用户账户才可以使用。
    • code>/wp-content/下面的其它目录应该由任何需要它们的插件/主题记录。权限会有不同。
    • The WordPress数据库文件备份插件需要/wp-content/ 文件夹可写。在有些情况下,这可能需要上交755个权限或者更多,(例如有些主机上777个权限)。

在这个论坛 thread上也可以看看这方面的讨论.


使用一个FTP帐户

FTP programs ("clients") allow you to set permissions for files and directories on your remote host. This function is often called chmod or set permissions in the program menu. FTP程序(“客户”)允许你为你的远程主机上的文件和目录设置权限. 这个功能通常称为chmod或者在程序菜单上设定权限. In a WordPress install, two files that you will probably want to alter are the index page, and the css which controls the layout. Here's how you change index.php - the process is the same for any file. In the screenshot below, look at the last column - that shows the permissions. It looks a bit confusing, but for now just note the sequence of letters.
center|thumb|400px|Initial permissions

Right-click 'index.php' and select 'File Permissions'
A popup screen will appear. center|thumb|305px|Altering file permissions

Don't worry about the check boxes. Just delete the 'Numeric value:' and enter the number you need - in this case it's 666. Then click OK.
center|thumb|400px|Permissions have been altered You can now see that the file permissions have been changed.

Unhide the hidden files

By default, most FTP Clients, including FileZilla, keep hidden files, those files beginning with a period (.), from being displayed. But, at some point, you may need to see your hidden files so that you can change the permissions on that file. For example, you may need to make your .htaccess file, the file that controls permalinks, writeable.

To display hidden files in FileZilla, in it is necessary to select 'View' from the top menu, then select 'Show hidden files'. The screen display of files will refresh and any previously hidden file should come into view.

To get FileZilla to always show hidden files - under Edit, Settings, Remote File List, check the Always show hidden files box.

Using the Command Line

If you have shell/SSH access to your hosting account, you can use chmod to change file permissions. Before you start using chmod it would be recommended to read some tutorial like this and also the manual page to make sure you understand better what you can make with it.

You can make all the files in your wp-content directory writable in two steps:

  1. Go to your WordPress main directory, with a command like cd wordpress/
  2. Enter chmod -R 777 wp-content

What does this mean? chmod is a unix command that means "change mode" on a file. The -R flag means to apply the change to every file and directory inside of wp-content. 777 is the mode we are changing the directory to, it means that the directory is readable and writable by WordPress. Finally, we have the name of the directory we are going to modify, wp-content.


If you use Permalinks you should also change permissions of .htaccess to make sure that WordPress can update it when you change settings or add some new Page (which requires update of the file to work when Permalinks are enabled).

  1. Go to the main directory of WordPress
  2. Enter chmod 666 .htaccess

Note that Filezilla is a very good FTP client. You can download it from download.com


See also

WordPress:htaccess for subdirectories