I feel that I have tried every solution online for the past few months with no solution.

When I go to install a plugin on Wordpress, it will not work and give me the error:

Unpacking the package…

Installing the plugin…

Could not create directory. /var/www/html/wp-content/plugins/PLUGIN_NAME/

Plugin install failed.

What annoys me is it used to work when I installed wordpress on the EC2, then all of the sudden it stopped working one day a few months ago.

What works is when I SFTP with Filezilla. So if I connect with FileZilla, I can create a directory and then manually extract the zip file on my computer and upload each individual file through fileZilla into the created directory.

When I SSH I use ec2-user

I played around with chown to ec2-user:ec2-user for /var/www/html and chmod to 777 and back to 755 and putting in the wp-config define('FS_METHOD', 'direct'); but still nothing.

Please help. Thank you.

  • chown to www-data user
    – bravokeyl
    Sep 9, 2016 at 6:27

1 Answer 1


Usually it happens when apache dont have write permission on the server, can you upload images from wp-admin. Plese try this.

  1. You can try give apache write permission as much as root on your server?

  2. To solve this issue you need to define the FTP details in your wp-config.php file so WordPress will remember it.

define('FS_METHOD', 'ftpext'); define('FTP_BASE', '/path/to/wordpress/'); define('FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/'); define('FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/'); define('FTP_PUBKEY', '/home/username/.ssh/id_rsa.pub'); define('FTP_PRIKEY', '/home/username/.ssh/id_rsa'); define('FTP_USER', 'username'); define('FTP_PASS', 'password'); define('FTP_HOST', 'ftp.example.org'); define('FTP_SSL', false);


  1. Alternatively, you may also provide WordPress with write access to your /wp-content folder by accessing the FTP root file and changing the folder file permission (CHMOD) to 775 rather than the default 755 and 644.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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