(Reading time: 6 – 9 minutes)
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.
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.
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.
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:
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:
- Good habits are hard to make and easy to break. So just do it.
- 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.





I get the “Connection Information” screen when attempting to upgrade a plugin automatically. I’m fine with providing the requested info, but it doesn’t work. And I’m quite sure I know why. The “Connection Information” screen doesn’t ask me what directory the web site is installed in. When I manually ftp to my site, it drops me into my home directory. I then change into the document_root of the web site I want to work on. I have a couple dozen web sites on this one account, all using the same ftp user. So how does WordPress know what directory to change into? Can I set that somewhere? Does it assume that the home directory is also the document_root? Is this info documented somewhere?
Scott,
Each WordPress installation has a set of constants that are defined. For example, WP_PLUGIN_DIR is defined as the location on the filesystem where your plugin directory resides. This location is obtained using dirname(__FILE__) php function (IIRC, didn’t look it up). You can see where WP_PLUGIN_DIR is defined and used here:
http://phpxref.ftwr.co.uk/wordpress/nav.html?_functions/index.html
For more information, poke around the constants listing for the source.
I will also have a plugin available soon which you can use to display your paths within your admin area. Watch for it on the plugins page.
I was looking for a fix for the “wordpress asks for connection information” on localhost problem. Turned out what I had actually needed was here:
http://www.viper007bond.com/2009/05/07/wordpress-how-to-force-direct-filewrites-for-upgrades/
in the added last 3 lines of the post.
There’s suprisingly little information on that on the net. I’m running under XAMMP on OS X, just a test install of 2.9-rare.
r
.-= Ricky Buchanan´s last blog ..Dictate News: Bluetooth, Mouse Control, and Discounts =-.
Yes!!! That one did the trick! Thanks heaps! :D
@Ricky – Thanks for this excellent reference! I’ll do some work on this article this week.
.-= Dave´s last blog ..7 Ways To Evaluate Blog Post Quality — Tuning your BS detector =-.
Hi, regarding author comment
“NOTE: June 18 2009. I’m still getting alot of traffic on this post… what is it that you’re looking for, exactly? Leave a comment, I’ll check into it if I can.”
I’ll tell you my exact problem.
1) Installed wordpress in a WAMP environment, that would be localhost. So somewhere you say that your hostname is ‘localhost’.
2) tried to upload the wp in a hosting, so I’ll have an address like ‘www.mysite.com’, BUT …. when I try to get to ‘www.mysite.com/wp-admin’, it forwards to:
http://localhost/wp-admin and says error…. and never can connect to the admin to change the value.
So that’s what basically I’m looking for, and probably what most users getting here are also looking for :P
Thanks in advance!
Jose
Jose, I don’t really get what your exact problem is here. The article deals with file system permissions instead of domain problems.
.-= Dave´s last blog ..Twitter Redux – Making Sense of Social Media Madness =-.
What I’d like to know, is what is WP doing when it FTPs? If it’s an outbound FTP, then why does it need account credentials for the machine on which it’s running? If it’s telling another host to FTP back into itself, then where is it sending these credentials?
Dave Saunders´s last post ..Texas House of Representatives devises plan to eliminate affiliate marketing in their state
The short answer is WP needs write permission as the correct user. There’s really not much more to it than that.
Dave Doolin´s last post ..Enabling Facilitating Encouraging- Website In A Weekend March 25-27- 2011
@dave so WP is not using those credentials for any part of the network activity? That’s what I’ve been wondering…it’s just sorta SUing as that user to set ownership of the files?
Dave Saunders´s last post ..Texas House of Representatives devises plan to eliminate affiliate marketing in their state
I can’t answer your question without some serious time poking around on the wp-hackers list and the wp source code.
My advice to you is scroll back through the commit history for the appropriate files, figure out who added that capability initially, correlate the commit with any activity on the wp-hackers list, then shoot an email off to the developer with any further questions.
That’s what I do: http://website-in-a-weekend.net/extending-wordpress/reverse-engineering-activation-hook-in-wordpress-plugin-api/
Also, from your question, I’m not sure what you mean when you write “credentials.” Authentication credentials are not the same as authorization credentials. If that’s not clear in your mind, that would be a good 3rd axis of attack on answering your question.
Once you get it all figured, I’d be delighted to consider running your findings as a guest post here on Website In A Weekend.
Thanks!
Thanks–I do just mean login info. I’m curious what it’s actually doing with that info because it would then impact which user info one places in there. I’m gonna look at the source as it’s driving me nuts now. LOL
Dave Saunders´s last post ..Texas House of Representatives devises plan to eliminate affiliate marketing in their state
Right, login is just authentication – verifying who you are. File system permissions are authorization – are you allowed to do some such thing?
Check out the difference between OpenID and OAuth to get a big picture overview.
WP has an internal authorization system as well, the user roles. Most people pay no attention and simply log themselves in as administrator role. Sort of like logging into your unix box as root. Maybe not that dangerous, but same sort of thing in general.
yeah, I get the distinction. I chaired some technical groups in the early 90s and the terms got flopped around with a few applications so I sometimes get a little careless when using the terms. My bad. ;-)
Dave Saunders´s last post ..Texas House of Representatives devises plan to eliminate affiliate marketing in their state
Both topics (and OpenID and OAuth) are massive hairballs anyway, but that starts ranging way too far afield for this website. Thanks for stopping by.
BTW: The chown command you suggested worked perfectly. Thanks!
Dave Saunders´s last post ..Texas House of Representatives devises plan to eliminate affiliate marketing in their state