Fixed – WordPress Asks for FTP Connection to Install Plugin

Why does WordPress asks for FTP Connection details?

WordPress allows to automatically install and upgrade plugins from within the the site without having to login into FTP.

A common problem is that WordPress is unable to access the filesystem directly, which results in a page indicating following message

To perform the requested action, WordPress need to access your web server. Please enter your FTP credentials to proceed……”.

Wordpress Asks for FTP

Wordpress FTP connection

WordPress Asks FTP Credentials

WordPress needs to make changes in the filesystem to install or upgrade the files.

Before modifying the files, WordPress need to have permission to make changes to the file system.

For WordPress to access the filesystem, functions that will write to the filesystem must be owned by the same user running  the apache process.

Who Owns Apache

There are 2 ways that I’m aware of finding apache owner.

Option 1:

Run the following command to find who owns apache

ps aux | grep apache

Sample Output

root@host [~]# ps aux | grep apache
root      3335  0.0  0.5 158828 12644 ?        Ss   16:44   0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody    9243  2.4  6.8 187336 158208 ?       S    18:08   0:34 /usr/local/apache/bin/httpd -k start -DSSL

Option 2:

Run the following command

egrep -iw --color=auto 'user|group' /etc/httpd/conf/httpd.conf
Apache Owner

Apache Owner

As you can see the User is nobody and he Group is nobody.

Go to wp-content folder and check its properties. Ownership should be either the username or root (whcih is why FTP credentials are required).

Change Ownership and Group

Using Win-SCP as FTP client you can change the ownership and group as follows (Right Click on Folder, select Properties)

  • Change Owner and Group to nobody.
  • Checkbox Set permissions recursively
  • Repeat this for other wordpress folders in the wp-admin and wp-includes

Alternatively, you can use chown command to ownership of the folders and files recursively.

Now try to  instal or upgrading the plugin. You shouldn’t be prompted for FTP connection credentials.

Quick Fix

If you don’t want to change the ownership of  folders within wordpress, here is another way to get around the FTP connection credentials prompt.

Open wp-config.php file located at /home/yourusername/public_html or /home/yourusername/

Add following 3 lines of code

define(“FTP_HOST”, “localhost”);
define(“FTP_USER”, “ftp-username”);
define(“FTP_PASS”, “ftp-password”);

Change the ftp-username and ftp-password.

Save the file.

Now, try to install or upgrade a plugin.

This should have fixed the wordpress FTP connection credentials prompt.

Now, happy installing or upgrading plugins and themes from within WordPress.

Comments Policy: Use a valid email address. Your words are your own, so be nice and helpful if you can. No ads, phone number or Email Id allowed in contents. No keywords in Name field.

Speak Your Mind

*