Can't install plugin and theme
Solution 1
You might also want to check the ownership of the folder: try this
sudo chown -R www-data:www-data /var/www
Solution 2
After a clean install of Wordpress locally, add below statement
define("FS_METHOD", "direct");
to my wp-config.php file.
Later change the ownership of the wp-content and the contents inside the wp-content folder to the web server user (_www) I used the below commands.
sudo chown _www:_www wp-content
sudo chown _www:_www wp-content/*
Alternatively you can also set the permission recursively using
sudo chown -R _www:_www wp-content/
Solution 3
It complains about FTP credentials when it cannot access the filesystem.
Most likely your permissions are wrong (directory inaccessible by webserver)
If you ensure that your wordpress directory is owned by the same user who runs your webserver, the FTP credentials note should disappear and you should be able to install themes and plugins via Wordpress Admin console.
petercheung
Updated on August 11, 2022Comments
-
petercheung almost 2 years
i want to install some plugin but show
Installation failed: Could not create directory.
that i find some solution add some code to wp-config
//* FTP Settings **/ /** wp-content path */ define('FS_METHOD', 'ftpext'); define('FTP_BASE', '/'); define('FTP_CONTENT_DIR', '/wp-content/'); define('FTP_PLUGIN_DIR', '/wp-content/plugins/'); define('FTP_USER', 'ftpuser'); define('FTP_PASS', 'ftppewd'); define('FTP_HOST', 'domain.com'); define('FTP_SSL', false); define("FS_METHOD", "direct"); define("FS_CHMOD_DIR", 0777); define("FS_CHMOD_FILE", 0777);
that the error message change to
Installation failed: Unable to connect to the filesystem. Please confirm your credentials
. i use IIS 8 use ftp client the ftp account has full access right
-
milan kyada almost 8 yearswhy did you use both ftpext and direct with
FS_METHOD
only one is enough either direct or ftpext? I suggest you to usedefine("FS_METHOD", "direct");
remove other constants -
petercheung almost 8 yearsif not add any thing the error show >Installation failed: Unable to locate WordPress content directory (wp-content).
-
milan kyada almost 8 years
-
petercheung almost 8 yearsif add define("FS_METHOD", "direct"); the error is Installation failed: Could not create directory.
-
milan kyada almost 8 yearsgive write permission to
wp-content
-
-
Jeet over 5 yearsI believe this is more correct and should be the accepted answer, since most of the cases permission on www is problem.
-
Sayed over 4 yearsAmong other things, adding
define("FS_METHOD", "direct");
anddefine("FTP_SSL", false);
fixed my problem! -
MIA over 4 yearsrunning this
sudo chown -R _www:_www [root directory]
fixed it for me.