I have a WP site running on Ubuntu 11.04. I set the apache www-data user to have write permissions on the entire wordpress directory recursively. This made it possible to update the plugins automatically, but the site upgrade functionality is prompting me for FTP credentials. How do I get that screen to work for updates without using FTP?
Easiest way: Use mod_suphp instead of mod_php. This should just be a matter of using whatever ubuntu's package manager is to remove mod_php and install mod_suphp instead.
mod_suphp is a slightly modified version of mod_php. It does the same thing, but it sets the user of the apache process to be the same as the owner of the PHP files when the PHP executes. This gives PHP the proper permissions to be able to modify the PHP files owned by that user.
This is actually more secure on a shared hosting environment, because in case of a break in via the web, the intruder only gains the privs of the one user account and can't access files outside that user account (whereas with the apache user credentials, he has greater access to many hosting accounts).
Anyway, with mod_suphp or any setuid method for running php scripts, this will let WordPress recognize that it can create files with the proper ownership and thus it will use the direct mode for upgrading itself.
You can permanently store the FTP credentials in wp-config.php. Add the following to this file:
define('FTP_HOST', 'ftp.example.com'); define('FTP_USER', 'user'); define('FTP_PASS', 'password'); define('FTP_CONTENT_DIR', '/home/username/public_html/wp-content/'); define('FTP_PLUGIN_DIR ', '/home/username/public_html/wp-content/plugins/');
This will prevent WP from prompting you for the credentials, and will use the values stored in wp-config.php instead.