All the files in my WordPress path are owned by myuser:www-data
and Apache is running as www-data. All files and folders have group write permissions, e.g. -rw-rw----
, but I keep being prompted for FTP details when I try to install a plugin.
If I chown the path to the www-data user, plugin installation and deletion work as expected, but then myuser cannot edit files. I could add myuser to the www-data group, but then myuser could access all other sites.
My files are chown’ed as follows:
chown -R myuser:www-data wordpress-folder/*
And chmod’ed as follows:
find wordpress-folder/ -type d -exec chmod 755 {} ;
find wordpress-folder/ -type f -exec chmod 644 {} ;
If my files are owned by the www-data group and are group-writable, then surely WordPress should be able to install plugins. Why can’t WordPress install plugins?
Here is the output of ls -la
in my plugins folder:
total 48
drwxrwx--- 9 myuser www-data 4096 Aug 5 01:26 .
drwxrwx--- 6 myuser www-data 4096 Aug 5 01:51 ..
drwxrwx--- 6 myuser www-data 4096 Jul 10 16:27 disqus-comment-system
-rw-rw---- 1 myuser www-data 6148 Jul 10 15:37 .DS_Store
drwxrwx--- 7 myuser www-data 4096 Jul 10 16:30 gravityforms
-rw-rw---- 1 myuser www-data 30 Jul 10 15:37 index.php
drwxrwx--- 3 myuser www-data 4096 Jul 10 16:30 lime-export
drwxrwx--- 6 myuser www-data 4096 Aug 1 11:17 mp6
drwxrwx--- 6 myuser www-data 4096 Aug 5 01:26 rewrite
drwxrwx--- 10 myuser www-data 4096 Jul 10 16:38 wordpress-seo
drwxrwx--- 7 myuser www-data 4096 Jul 24 17:14 wp-minify
If you add the following to your wp-config.php file it will force WordPress to use the ‘direct’ filesystem method:
I think, I’ve answered a similar question here before. OP claims all file permission are set correctly but still ask for ftp credentials.
Well, this is very weird. But I think, it is still about permission.
WordPress will write a temp file and compare the file owner by
getmyuid() == @fileowner($temp_file_name)
.If ture, it’ll install the plugin directly without asking ftp details.
For more details,
wp-admin/includes/file.php
andget_filesystem_method
function.So, I would suggest you, write an independent php script in the root folder of wordpress installation to check out.
1, write a temp file
2, check the owner of the temp file
Simple workaround would be to add FTP credentials inside wp-config.php file, like this:
But the problem might be related to your hosting using some different PHP process instead of suPHP.