Page 1 of 1

[WordPress] Update Failed: Could not create directory.

PostPosted: 23. September 2017 00:16
by abdulhakeem
I'm running XAMPP on Arch Linux

XAMPP Version: 7.1.9-0

lampp status says everything is running

I'm trying to do WordPress development on my localhost using the XAMPP stack, everything is installed in /opt/lampp

WordPress is successfully installed and running, but when I try to update a plugin or install a new one, I get this error message in the WordPress Dashboard>Plugins.

Update Failed: Could not create directory.


I ran lampp security and configured passwords for everything, including the FTP user 'daemon'.

/opt/lampp/htdocs/site/wp-content/plugins is set for 755 permissions, but I've also tried 777

/opt/lampp/htdocs/site/wp-content/plugins is owned by nobody:nobody (as most everything is in /opt/lampp), but I've also tried chowning to www-data, root, my local user account, daemon, and none of them make any difference

When WordPress prompts me for FTP credentials after clicking Update on the plugin, I'm logging in with daemon + the password I created for FTP user when I ran lampp security, but I've also tried logging in as nobody, root, and my WordPress username for the particular sites, none of which work. I select FTP rather than SFTP on the radio buttons. I use localhost for hostname.

I've tried adding define(‘FS_METHOD’,’direct’); to the very bottom of my wp-config.php file, doesn't help

I've checked for a vsftpd.conf file in order to add write_enable=YES to it, but it doesn't seem to exist anywhere, inside or outside of my XAMPP directory (/opt/lampp)

I'm kinda stumped here, I'm not sure what else could be going wrong. Does anyone know what I'm missing here? I don't think it's a WordPress issue, because on Windows using MAMP everything works without a hitch, so I'm fairly confident it must be something that I'm missing or doing wrong with XAMPP.

Re: [WordPress] Update Failed: Could not create directory.

PostPosted: 23. September 2017 17:24
by Nobbie
abdulhakeem wrote:I don't think it's a WordPress issue, because on Windows using MAMP everything works without a hitch, so I'm fairly confident it must be something that I'm missing or doing wrong with XAMPP.


Yes and no, its not a WordPress issue, but also not a Xampp issue. Its a linux issue. You have to grant access to /opt/lampp/..... for the User which runs Apache and PHP (i think its "daemon" out of the box, but of course you can change it to your needs in httpd.conf, watch out for "User=...." and "Group=...").

Keep in mind that it is NOT sufficient to grant access only to a deep subdirectory, you also need appropriate permissions for all(!) parent folders, i.e /opt/lampp/htdocs as well as /opt/lampp as well as /opt.

At next you need to configure a FTP Server and a "appropriate" User, whichs HOME directory points to the WordPress installation folder (i.e. /opt/lampp/htdocs/wordpress or /opt/lampp/htdocs. If in doubt, ask in a WordPress forum, as this is a WordPress issue).

May personal solution to this problems usually is:

a) i create a new linux user "xampp". The HOME directory for that User is set to /opt/lampp/htdocs

b) I change file permissions in /opt/lampp and/or ownership to user "xampp". Whatever is needed (that is a plain linux thing). Dont forget about setting /opt as well (see above)

c) i change httpd.conf and apply "User=xampp"

d) I run "ftp" in a terminal and login with user xampp, in order to find out if the FTP server (whichever you are running) points to the right folder and can access everyting what is desired

Finally restart Apache / PHP and apply FTP credentials to WordPress. Or/and whereever it is needed.

Re: [WordPress] Update Failed: Could not create directory.

PostPosted: 24. September 2017 00:03
by abdulhakeem
Thanks for the suggestions, I'll give it a try!

Re: [WordPress] Update Failed: Could not create directory.

PostPosted: 24. September 2017 09:14
by Nobbie
What puzzles me - just for fun i installed WordPress on my laptop yesterday (Linux Mint with Xampp) and a brand new WordPress release. After installation had finished, i also updated a plugin - but: it worked out of the box and without any FTP server! Dont know why, I am not an expert in WordPress, but there was no error message about missing or wrong FTP credentials (and i also did not provide any).

Hm?