WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I don't think this is a duplicate, although I've seen similar questions on here.

I have added my primary SSH/FTP user and the user nobody to a group called webserver, then I ran a chown -R .webserver /var/www so that both FTP and Apache would be able to write to the file system.

I know that PHP can write to the server -- I can upload an image using the Media Library. However, when I go to install a plugin, it prompts me for my FTP credentials.

If I add define('FS_METHOD', 'direct'); to wp-config.php, this goes away and plugins install without an issue.

Why would this happen, though? According to the Codex, the preferred method is direct, and it's able to manipulate the file system directly. So what would make it prompt for FTP instead?



I took a look at the source for how it determines what file system method to use (wp-admin/includes/file.php, line 933), and I figured out that it can create a test file, but the owner does not match the processor's UID. Taking a look at the PHP manual for getmyuid() and fileowner($file), it seems that, instead of using getmyuid(), it should be using posix_getuid(). Any idea why the developers would use the former?


Noted in WordPress bug tracker: https://core.trac.wordpress.org/ticket/10205

share|improve this question

Posix is a PHP extension rather than part of PHP core. WordPress tries to minimize use of extensions as much as possible in its core. In specific case of Posix one — it has very notable flaw of not being available on Windows platform altogether.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.