Question

why i can't install a new plugin on my wordpress?

  • Posted December 30, 2014

I can connect my vps ip with putty ,hostname is a.b.c.d , ftp user is root ,password is password . None of connection type (ftp or ftps) can add a new plugin .

Failed to connect to FTP Server
Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Imgur

Subscribe
Share

This comment has been deleted


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Wordpress will prompt you for FTP credentials if it does not have permission to write the files it needs to. If you log in via putty and run the following command (assuming this is an Ubuntu droplet) it will set the files to be owned by the user that the web service is run as and should resolve the problem.

chown -Rf www-data.www-data /var/www/html/

On Centos running Apache to serve you can do like above but for the apache user

sudo chown -R apache:apache /var/www/html

hope this helps someone

The command solved my problem. What does www-data.www-data mean? www-data is the group name ,how about the second www-data ?

root@rebuild:~# cat /etc/group www-data:x:33:

Hi, a bit late reply but still might be helpful to someone.

It depends if you have previously added your own user and changed the permissions of the folders and files.

If everything is by default and configuration changes were made, you can try

chown -Rf www-data.www-data /var/www/html/ (for Ubuntu with Nginx)
chown -R nginx.nginx /var/www/ (for CentOS with Nginx)

But then you might need to edit anything from the command line with sudo

Also, you can set the permissions for your user and give the files and directories the following ownership not to use the sudo command Considering that the location of your WordPress installation is in /var/www/yoursitename/public_html, if it’s any different, please replace accordingly to match your directory structure

sudo chown -Rf yourusername:www-data /var/www/yoursitefolder/public_html/
sudo find /var/www/yoursitefolder/public_html -type d -exec chmod 755 {} \;
sudo find /var/www/yoursitefolder/public_html -type f -exec chmod 644 {} \;
sudo find /var/www/yoursitefolder/public_html/wp-content/ -type d -exec chmod 775 {} \;
sudo find /var/www/yoursitefolder/public_html/wp-content/ -type f -exec chmod 664 {} \;

The first 3 commands will give you the permissions to the WordPress files and directories, and the last 2 commands will give permission for the server.

Also, it is considered a good practice to secure your wp-config.php configuration file.

If you have changed anything in the Nginx or PHP configuration files, in order to reflect the changes you will need to restart the fastcgi service (for example for the PHP7.4) with

sudo systemctl restart php7.4-fpm.service

otherwise it will keep on asking you for your FTP credentials.

And you should be able to normally use the wp-admin from the browser and install/update plugins and themes, as well as edit and change anything inside your site directory as your user without the sudo command.

chown -Rf www-data.www-data /var/www/html/

Single command.

use commad like this

root@server:~#chown -Rf www-data.www-data /var/www/html/

yes working fine

The error is on wordpress side, giving useless information

Mmmh, is wordpress made by microsoft?

Hey forum… This seems to be the thread with the right answers so if there’s help out there, HELP!

I’ve been trying to upload an image but I’m encountering the following error:

“Unable to create directory /wp-content/uploads/ Is its parent directory writable by the server?”

I’ve tried the solution listed above but my story isn’t a resounding success, iike so many others. The error persists. I installed via xampp and wordpress and I’m running OS X. I believe I’ve read every article on fixing permissions but none of the solutions have worked for me, or I have some kind of coding deficiency.

Any help would be greatly appreciated.

I don’t quite understand… Where should I type it? I get the FTP Username but don’t know the Password. Can I change it somehow?

not working