To perform the requested action, WordPress needs to access your web server.

To perform the requested action, WordPress needs to access your web server.

But wait a minute I’m WordPress is running locally. Perhaps on MAMP?

[php]
define(‘FS_METHOD’,’direct’);
[/php]

What is it? According to WordPress.org:

(Primary Preference) “direct” forces it to use Direct File I/O requests from within PHP, this is fraught with opening up security issues on poorly configured hosts, This is chosen automatically when appropriate.

Here’s the code:

[php]
if ( ! $method && function_exists(‘getmyuid’) && function_exists(‘fileowner’) ){
if ( !$context )
$context = WP_CONTENT_DIR;

// If the directory doesn’t exist (wp-content/languages) then use the parent directory
// as we’ll create it.
if ( WP_LANG_DIR == $context && ! is_dir( $context ) )
$context = dirname( $context );

$context = trailingslashit($context);
$temp_file_name = $context . ‘temp-write-test-‘ . time();
$temp_handle = @fopen($temp_file_name, ‘w’);
if ( $temp_handle ) {
if ( getmyuid() == @fileowner($temp_file_name) )
$method = ‘direct’;
@fclose($temp_handle);
@unlink($temp_file_name);
}
}
[/php]