Wordpress on Ubuntu install plugins without FTP access

一笑奈何 提交于 2020-01-01 04:06:07

问题


I run my own web server for development and, on it, I installed a WordPress instance. When I try to add plugins to this instance from the admin interface, WordPress asks for FTP access.

I don't use FTP and have no plans to do so in the future. I know I can change some configuration in WordPress so that I am able to upload without FTP. What exactly should I configure to accomplish this?


回答1:


One of three things:

  1. Either change permissions so your web server can read the wp-content directory, which should be fine for a development server.
  2. Run PHP as FastCGI which can run as a different user than your web server.
  3. Install the ssh extension for PHP (sudo apt-get install libssh2-php on ubuntu on think)



回答2:


Execute this command on your ubuntu terminal

sudo chown -R www-data /var/www



回答3:


I was not satisfied with any of these answers so I kept on searching. I found an answer that was so simple I was surprised it had not been mentioned already.

https://askubuntu.com/a/826805/145472

This answer says to add a line to wp-config.php

define('FS_METHOD', 'direct');

Job done. I cannot take credit for knowing this but I do feel it needs a mention here too.




回答4:


The funny thing is that uploading media works. So I was wondering why plugins not? After changing the ownership of wp-admin it worked for me.

sudo chown -R www-data wp-admin


来源:https://stackoverflow.com/questions/3492759/wordpress-on-ubuntu-install-plugins-without-ftp-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!