Can I install/update WordPress plugins without pro

2019-01-04 04:12发布

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

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
26条回答
Viruses.
2楼-- · 2019-01-04 05:01

It is possible to use SFTP or SSH to auto update Plugins in WordPress, but you need to have ssh2 pecl extension. You can find out how to do it, using the following tutorial

查看更多
爷的心禁止访问
3楼-- · 2019-01-04 05:03

Execute the following code in terminal

sudo chown -R www-data /var/www

For further detail visit Wordpress on Ubuntu install plugins without FTP access

查看更多
Explosion°爆炸
4楼-- · 2019-01-04 05:07

Just wanted to add that you must NEVER set the wp-content permission or permission of any folder to 777.

This is what I had to do to:

1) I set the ownership of the wordpress folder (recursively) to the apache user, like so:

# chown -R apache wordpress/

In case of Ubuntu, Mint or Debian # chown -R www-data:www-data wordpress/

2) I changed the group ownership of the wordpress folder (recursively) to the apache group, like so:

# chgrp -R apache wordpress/

Skip this step for Ubuntu, Mint or Debian

3) give owner full privilege to the directory, like so:

# chmod u+wrx wordpress/*

And that did the job. My wp-content folder has 755 permissions, btw.

TL;DR version:

# chown -R apache:apache wordpress
# chmod u+wrx wordpress/*
查看更多
仙女界的扛把子
5楼-- · 2019-01-04 05:08

In order to enable the use of SSH2 for your updates and theme uploads, you have to generate your SSH keys and have the PHP SSH module installed. Then WordPress will detect that you have SSH2 available and you'll see a different option (SSH2) displayed when doing an upload/upgrade.

1.) Make sure you have the PHP module installed for debian it is:

sudo apt-get install libssh2-php

2.) Generate SSH keys, adding a passphrase is optional:

ssh-keygen
cd  ~/.ssh
cp id_rsa.pub authorized_keys

3.) Change the permission so that WordPress can access those keys:

cd ~
chmod 755 .ssh
chmod 644 .ssh/*

Now you'll get the SSH2 option when doing an upload/upgrade/plugin. WP SSH Connection

4.) For added ease you can setup the defaults in your wp-config.php and this will pre-populate the SSH credentials in the WordPress upload window.

define('FTP_PUBKEY','/home/<user>/.ssh/id_rsa.pub');
define('FTP_PRIKEY','/home/<user>/.ssh/id_rsa');
define('FTP_USER','<user>');
define('FTP_PASS','passphrase');
define('FTP_HOST','domain.com');

The 'passphrase' is optional, if you don't setup a passphrase during ssh-kengen; then don't add it in wp-config.php

This solved my issue. And I didn't have to do the chown at all. But I have seen this method referenced in other places.

References:

查看更多
\"骚年 ilove
6楼-- · 2019-01-04 05:08

Add the following code to wp-config

define('FS_METHOD', 'direct');

FS_METHOD forces the filesystem method. It should only be direct, ssh2, ftpext, or ftpsockets. Generally, you should only change this if you are experiencing update problems. If you change it and it doesn't help, change it back/remove it. Under most circumstances, setting it to 'ftpsockets' will work if the automatically chosen method does not.

(Primary Preference) "direct" forces it to use Direct File I/O requests from within PHP, this is fraught with opening up security issues on poorly configured hosts, This is chosen automatically when appropriate.

(Secondary Preference) "ssh2" is to force the usage of the SSH PHP Extension if installed

(3rd Preference) "ftpext" is to force the usage of the FTP PHP Extension for FTP Access, and finally

(4th Preference) "ftpsockets" utilises the PHP Sockets Class for FTP Access

For more information visit: http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants

查看更多
孤傲高冷的网名
7楼-- · 2019-01-04 05:09

1.change from php_mod to fastcgi with cgi & SuEXEC enabled ,works for me

don't forget if don't work try to change
2. change wp-content to 775 as root
chmod -R 775 ./wp-content
3- add to wp-config.php
define('FS_METHOD', 'direct');

i hope it works

查看更多
登录 后发表回答