I just installed WordPress 3.5.2 on an Amazon Linux AMI EC2 micro instance. When I tried to install the wp-db-backup plugin (Plugins -> Add New), I was prompted for a Hostname, FTP Username, FTP Password and Connection Type.
The answer to this question recommended that passwd
be done at the command line. I’m not clear on exactly what I’m doing at the commandline based on this answer. So I Googled and found an article on configuring vsftpd. The article discusses the generation of a certificate on the server and I’m wondering whether I’m going off track here by following this article. I’m using CentOS 6.3 locally, and an Amazon Linux AMI on EC2).
Any assistance/guidance will be appreciated.
EDIT
I was reading the WordPress Codex which discussed ftp constants for the wp-config.php file. It recommended that I define as few of these constants as needed to correct my update issues. I’m I on the right track here (especially security-wise)? I’ve listed the constants below. Any guidance will be appreciated.
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);
The main issue here is that apache does not have access to the folders. The default permission is given to the ec2-user in the AMI.
run this in your terminal and you should be good to go.
Once this is done you should be able to upload themes, plugins, updates etc.
Try this code in your wp config file
change owner of wordpress directory
OR try
This worked for me:
First follow what Faizan said to do and put the following line if your
wp-config.php
:Then you need to TEMPORARILY swap your file permissions to a more open state. In the command line type the following:
Now run your updates and then change the permissions back to something sane like:
I’m aware this is a security issue and maybe not the best way to do this, but its the only thing I could try that got it to work for me.
I found the answer to this question at Stephen White’s blog post.
In a nutshell, I have to
and put my FTP setting in the wp-config.php file
This works very well for me now.
if this doesn’t work, try replacing “apache” with “www-data” and you’ll be good to go.
The ‘define(‘FS_METHOD’, ‘direct’);’ suggestion worked for me after editing my security group in EC2 to allow outbound access to the port 443 (HTTPS)
sudo chown -R www-data:www-data /var/www/html/wordpress
the above command did the trick for me.
For me it was a selinux issue. This did it for me:
chcon -Rv --type=httpd_sys_rw_content_t /var/www/html/
See: https://www.svnlabs.com/blogs/centos-7-selinux-apache-php-writeaccess-permission/