我可以在不提供 FTP 访问的情况下安装/更新 WordPress 插件吗? [英] Can I install/update WordPress plugins without providing FTP access?

查看:26
本文介绍了我可以在不提供 FTP 访问的情况下安装/更新 WordPress 插件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的仅使用 SFTP 使用 SSH 密钥.

I am using WordPress on my live server which only uses SFTP using an SSH key.

我想安装和升级插件,但您似乎需要输入您的 FTP 登录名才能安装插件.有没有办法通过手动上传文件而不是让 WordPress 处理整个过程来安装和升级插件?

I want to install and upgrade plugins, but it appears that you are required to enter your FTP login to install the plugins. Is there a way to install and upgrade plugins by manually uploading the files instead of having WordPress handle the entire process?

推荐答案

WordPress 只会在尝试安装插件或 WordPress 更新时提示您输入 FTP 连接信息,如果它无法写入 /wp-content直接.否则,如果您的 Web 服务器具有对必要文件的写访问权限,它将自动处理更新和安装.此方法不需要您具有 FTP/SFTP 或 SSH 访问权限,但需要您在网络服务器上设置特定的文件权限.

WordPress will only prompt you for your FTP connection information while trying to install plugins or a WordPress update if it cannot write to /wp-content directly. Otherwise, if your web server has write access to the necessary files, it will take care of the updates and installation automatically. This method does not require you to have FTP/SFTP or SSH access, but it does require your to have specific file permissions set up on your webserver.

它会按顺序尝试各种方法,如果 Direct 和 SSH 方法不可用,它将退回到 FTP.

It will try various methods in order, and fall back on FTP if Direct and SSH methods are unavailable.

https://github.com/WordPress/WordPress/blob/4.2.2/wp-admin/includes/file.php#L912

WordPress 会尝试将临时文件写入您的 /wp-content 目录.如果成功,它会将文件的所有权与其自己的 uid 进行比较,如果匹配,它将允许您使用直接"方法安装插件、主题或更新.

WordPress will try to write a temporary file to your /wp-content directory. If this succeeds, it compares the ownership of the file with its own uid, and if there is a match it will allow you to use the 'direct' method of installing plugins, themes, or updates.

现在,如果由于某种原因您不想依赖自动检查要使用的文件系统方法,您可以在 wp-config 中定义一个常量 'FS_METHOD'.php 文件,即 'direct'、'ssh'、'ftpext' 或 'ftpsockets' 它将使用该方法.请记住,如果您将此设置为direct",但您的网络用户(运行网络服务器的用户名)没有适当的写入权限,您将收到错误消息.

Now, if for some reason you do not want to rely on the automatic check for which filesystem method to use, you can define a constant, 'FS_METHOD' in your wp-config.php file, that is either 'direct', 'ssh', 'ftpext' or 'ftpsockets' and it will use that method. Keep in mind that if you set this to 'direct', but your web user (the username under which your web server runs) does not have proper write permissions, you will receive an error.

总而言之,如果您不想(或不能)更改 wp-content 的权限以便您的 Web 服务器具有写入权限,请将其添加到您的 wp-config.php 文件中:

In summary, if you do not want to (or you cannot) change permissions on wp-content so your web server has write permissions, then add this to your wp-config.php file:

define('FS_METHOD', 'direct');

<小时>

此处解释权限:


Permissions explained here:

这篇关于我可以在不提供 FTP 访问的情况下安装/更新 WordPress 插件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆