Stumble Digg Technorati Delicious

How To: Stop WordPress Asking For FTP Info To Upgrade Plugins

Buzz This!
August 14th, 2009 by Jesse

Does your WordPress site ask you for FTP login information every time you want to add, delete or upgrade a plugin? This starts off as a minor annoyance, but after time can grow to be one of those things that can drive you crazy or make you wonder why it’s happening when it didn’t happen before, or doesn’t happen on other sites that you have that are on other servers.

I will show you s simple way to fix this annoyance and give you a brief explanation about why this happens. WordPress is picky about file ownerships and who can do what with those files. If your server uses a different username than what wordpress expects for the site it won’t allow it access without you providing those FTP login credentials every time you need to add, delete or upgrade a plugin. If you are on a shared host you will likely never see this happen but if you are on a VPS or Dedicated server it’s quite likely that you will, but don’t worry its a very simple work around to stop this from happening. If you wish to, installing suPHP on your server will also fix this issue or you can read on for the other alternative.

First off, you will need to open up your wp-config.php file (which if you are doing things right will be one directory above your sites root directory) and in this wp-config.php file you just simply have to add your ftp loing information and you will never have to type it in again, so without further ado heres the bit of code you want to add to your wp-config.php file.

//*added ftp login credentials to avoid the annoying prompt asking for login info every time I wanted to upgrade a plugin*
define('FTP_HOST', 'ftp.yoursite.com');
define('FTP_USER', 'Your_FTP_Username');
define('FTP_PASS', 'Your_FTP_password');
//*If you can use a SSL connection set this to true*
define('FTP_SSL', true);

That’s it, set these options, save the file and you are all set.


  • Rick
    It happens because your directory permissions are not set correct. When WordPress cannot directly download a file, it will try to FTP it. Your WordPress files (and directories) need to be owned by the same user and group as what your Apache web server is running as (which is usually "apache"). This allows the web server to write to your WordPress directory.

    So, an easy fix would be to secure shell in to your site and do the following... let's say your WordPress is in the "httpdocs" directory located under /var/www, you would change to the /var/www directory then run "chown -R apache:apache httpdocs". You run that without the quotes of course, and substitute the correct username in the place of "apache" if your server process runs as a different user. The -R tells it to be recursive so that it will change all of your WordPress files and directories.

    There is one small drawback to doing this... after this, you won't be able to FTP files to the site... you'll have to use the built in WordPress tools for working on your site, adding images, etc. If you ever need to FTP files to the site, you would need to do the same steps as above but change "apache" to your ftp username. After you do your upload, repeat the steps above. You can of course change just single directories... if you always upload in to wp-content/mymedia or something like that, then just "chown" that directory to be owned by your ftp credentials and leave the rest owned by Apache and you'll be able to do both.
  • Hi, thanks for stopping by. you are correct but i feel a much easier
    solution is to use suPHP on the server to manage the ownerships properly so
    wordpress and ftp work as they should, just a much easier situation for most
    people out there.
  • Thanks for the hint on suPHP. I run a VPS and always wondered why it asked for FTP. I installed suPHP, restarted Apache and - BAM - it no longer asks!

    THANKS!
    .-= Greg“s last blog ..How To: Insert Google Analytics or Mint Tracking Code in Thesis =-.
  • Glad to be of help, especially for a fellow cheesehead (even if you don't live in WI anymore)

    Hope Alabama is treating you well, I stopped by your site and checked it out, looks good.
  • Very easy, indeed. Thnx!
blog comments powered by Disqus

"Posts from AdminDaily for 03/08/2010 - http://eepurl.com/iZEJ"

7759