When attempting to install a Plugin, Theme or use the WordPress Autoupdate feature the process may fail or request that you provide your FTP credentials in order to complete the install.
This is a common error and one most likely to happen for users that have not configured their webserver’s root directory correctly.
Basic Overview of the Unix File System
If you have a basic understanding of the unix file system and how programs operate then you understand that when a user uploads a file to a webserver directory they are the owner of that file and the directory it sits in. The user has the ability to make the file readable, writable and executable and they can set those permissions to restrict or allow access to others.
In order to set the permissions you must be the owner of that portion of the file system. If you login by ftp and try to access a folder in another person’s web root you may be restricted (hopefully) but if you can get into their directory the other user can restrict you from reading, writing or executing their files and subfolders.
The WordPress FTP Problem
So, now that you kinda understand that the webserver’s file system requires a USER to have Permission to access and execute files you can apply that to what is actually happening when an Autoupdate or install fails.
Basically Apache or your Webserver that allows WordPress to run is having problems accessing the directories where your website is stored. When Apache can not access your directories WordPress will attempt to use the program FTP to move files and set permissions.
So how can you fix this?
Unfortunately this may not be something that you can fix yourself and you may need to either find a better webhost that can support WordPress or continue to provide your FTP credentials everytime you use a web install.
If you have the ability to configure your server then you will need to change ownership or use the unix chown command to apply permissions to your webroot so that your webserver shares ownership.
Is there a Work Around?
Well yes WordPress is presenting you with the FTP workaround for when hosts are not compliant with normal operation.
The only other possibility you have is to manually update files through FTP by uploading files. If you are updating the WordPress application to a new version you should first make a backup of your working install. Then you can delete your root files with the exception of your index.php and wp-config.php files. You can delete your wp-admin and wp-includes folders but you want to keep your wp-content folders that contain your themes plugins and other important files.
Uploading themes and plugins by FTP is rather simple you just place them in the correct folders under your wp-content folder. They will be automatically recognized by WordPress when you refresh your Dashboard Control Panel page.
Final Note
Some people also experience problems with Autoupdates if they are using PHP 4 instead of PHP 5.
Many hosts will allow you to select between these versions of PHP and the setting can be in your hosting control panel such as cPanel or Plesk or you can set the preference in a .htaccess file placed in your website’s root folder.
Changing ownership and file permissions can be a risky thing for new users of the Unix / Linux operating system if their website is accessible to the internet. If you are a VPS or Managed Server Customer you should contact your website host technical support and this procedure will likely be covered under routine maintenance.
If you are a dedicated server customer or host your own servers then you should already understand the problem. If not then make sure you read up on how to accomplish this procedure safely.