Need a WordPress website this weekend? Start here...

How To Fix FTP Connection Error on Localhost WordPress

(Reading time: 6 – 9 minutes)

Updated January 27, 2012. Thank you for visiting. This is the most popular blog post on Website In A Weekend. Your +1 is highly appreciated!

Overcast and drizzling here in paradise, that is, the east side of San Francisco Bay. This is the second time it’s rained in June. It never rains in June here! Not since 1998 that I can remember. In any case, let’s see what else the day brings.

Since WordPress 2.8 is scheduled for release sometime today, let’s check out a copy of WordPress 2.8 from subversion, install it on localhost, and poke around a bit.

My handy instructions for 5 minute WordPress installation don’t work exactly the same when installing on locahost. I don’t have cPanel installed locally, so I had to create the MySQL database and database user manually using a cygwin shell window.

First look: no major changes obvious to me other than the spiffy theme browser. So, let’s install a new theme, right from the WordPress.org theme repository.

Uh oh… FTP Connection Information required.

FTP connection information required indicates permission problem on host

FTP connection information required indicates permission problem on host

The WordPress connection information is telling me I can’t upgrade because WordPress doesn’t have permission to write files new files on the host.

That’s not good, and it needs to be fixed, pronto.

This wasn’t a problem when I initially installed WordPress, because I manually copied the WordPress files to the correct location.

Short answer

Have your FTP information ready and type it into the form as required. You should have FTP account information as part of your web hosting account. If everything is working correctly, the installation should proceed without issue.

Longer story

When typing your information into the web form simply will not work, you need to investigate more:

  • Ensure your FTP account information actually is correct. If necessary, create a new FTP account with “known good” username and password. Make sure to test the new FTP account in an FTP client other than WordPress. Now try the above procedure again.
  • If you’re still having problems, check to ensure your directory permissions are set correctly. One way to check your permissions is to use the WP Security Scan plugin, which will scan your WordPress installation and let you know which file and directory (folder) permissions are correct, and which are incorrect.

By the way, if you’re finding this article useful, I send out updates to Website In A Weekend via the newsletter. You can sign up using the form at the top of the sidebar. Thanks!

If you’re a developer, check out more articles in Extending WordPress.

What if you’re running on localhost?

I’m running on localhost, I shouldn’t need to provide FTP information. So why the problem? Let’s poke around on Google and see what we get… using “wordpress connection information” gives us two likely pages from wordpress.org (here, and here), and “Why WordPress Asks for Connection Info” from Chris Abernethy. You should read all three of these pages, and if you’re running on a remotely hosted server such as bluehost.com, these three links should be enough.

If you’re running on localhost, read on…

(or skip down to what to do on your hosted server)
Fire up a cygwin shell window and take a look. You could almost as easily do this using Windows cmd shell, but I prefer cygwin and bash.

File system ownership change fixing FTP connection error

File system ownership change fixing FTP connection error

See the top red box? One of these things is not like the other!

All the WordPress installations running on localhost run as Admistrators, but wp28 is running as my username “doolin.” How did that happen? Hard to say. Perhaps a slight change in how 2.8 installs itself. That’s a matter to dig into deeper in the future. Right now, we have other work to do.

If you like this article and find it helpful, you could help me in return with a +1. Thanks!

Clearly, the ownership of the “wp28″ directory needs to be changed. Since I don’t remember exactly what the flag for recursive changes are using the “chown” command. It’s either “-r” or “-R” so let’s look it up first using the man page, as indicated by the blue arrow. The unix man page browser opens in a pager, when the pager closes, it advances one line in the shell; you don’t see the chown information in the screenshot.

Now that you have the correct information, issue the chown command as shown in the bottom red box.

All fixed!

But is it…?

One of my first tasks after installing a new WordPress blog is checking the security setup. It should be one of your first tasks as well. Downloading and activating Michael Torbert’s WP-Security shows us the following problems with respect to file system permissions:

Use WP-Security to check file system permissions

Use WP-Security to check file system permissions

That’s nasty. Now, since this installation of WordPress is running on localhost, it probably doesn’t matter all that much whether I fix them or not. But I should, and I will:

  1. Good habits are hard to make and easy to break. So just do it.
  2. Changing permissions is trivial using the bash shell from the cygwin command line. bluehost.com allows ssh access to a bash shell on the host, so I can use the exact same commands there in the future, if necessary.

When you get an FTP Connection error when upgrading or updating, block aside a little bit of time to dig into the problem, and prepare to learn a tiny bit of unix magic. It’s not difficult, and it will pay you back later.

Changing permissions on your web host

The easiest way to check your relevant permissions is to use the WP-Security plugin as mentioned above.

What I do when I find anything out of order is use the FileZilla FTP client to change the permissions to the correct values. There’s plenty of information on Google about how to do this, leave a comment if you want more explanation here.

Hat tip Hat tip : If you’re an advanced user, check out Viper 007Bond’s explanation of new capabilities for file system handling in WordPress 2.8. (Hat tip Ricky Buchanan from the comments.)

Dealing With Internal Server Issues — When the web server coughs up error code 500

(Reading time: < 1 minute)

Ever get one of these?

500 – Internal Server Error
This is a temporary server error.
Please try to reload the webpage later.

Check your server error log. If you are hosted with bluehost.com, you will be running the Apache server, and your error log* will look something like this:

[Read more...]