Problems importing Wordpress into Amazon Web Service (EC2) - wordpress

I set up my server with mysql and php on Amazon with "Amazon Linux AMI 2014.03.2 (HVM)".
Then i install wordpress and now it's running perfectly on my server.
I'd like to import all the contents from my other server. So I export the posts to xml.
In my amazon server I use the import plugin of Wordpress.
However, this plugin (the import from wordpress) needs a password, and the only pass i have the .pem. So, what can i do and how?
Thanks in advance.

The password you need is for FTP, which is how WordPress transfers the files to your server.
If you don't have FTP set up, that's not a problem, but you'll need to install the plugin manually.
The plugin that you're after is available here: https://wordpress.org/plugins/wordpress-importer/
To install, just download the zip file and upload into your wp-content/plugins folder.

You can update your wordpress themes and plugins to your amazon instance without using your .pem file. When you go to wordpress and want to update your theme or plugin and wordpress is prompting you for a host, user, and password then wordpress does not have the permisions to write to your wordpress/wp-content/theme or wordpress/wp-content/plugins folders.
The best solution I have found is this answer. Add the line define('FS_METHOD','direct') in the following way:
wp-config.php
/** MySQL database name*/
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'wordpressuser');
/** MySQL database password */
define('DB_PASSWORD', '1234');
/** Add this line: sets up direct method for wordpress, auto-update without
ftp **/
define('FS_METHOD','direct');
Save and Exit
Next you need to set permissions in the wordpress directories to give wordpress the ability to write these files when you request a new theme or plugin. More specifically, you need to apply www-data access for apache and php. For myself, I have set this permission on folders www, wordpress, wordpress/wp-content, wordpress/wp-content/plugins, and wordpress/wp-content/themes.
This is an example of the file structure I had. $HOME/www/wordpress/wp-content/...You can check your file permission with
ls -la
thru the command line first. As you set the permission you can check to make sure the www-data permission is set on the folder correctly. Here are two examples to setting the www-data permissions to allow wordpress to automatically make the update.
sudo chown www-data.www-data plugins
sudo chown www-data.www-data themes
See this image as a further illustration of what your permissions should look like. Also note the upgrade file. That was added after I added the first theme to the wordpress app.
The site I found a good set of basic instructions to achieving this was here. I just needed to extract the details for permissions to make the automatic update work.

Related

Giving write permission back to Wordpress on AWS EC2 via PuTTY

I recently had a PHP syntax error that crashed my server after using the plugin editor on my Wordpress website. It is an AWS Elastic Beanstalk hosted website, so I had to use PuTTY to change the file permissions and allow ec2-user to read/write durring SFTP via Filezilla.
I am not experienced with his sort of thing and followed the information from this question to accomplish this task.
Everything went well, but now I cannot edit or "write" anything via my Wordpress website. No plugin updating, no file editing, nothing. It says I need to change my permissions.
Due to my lack of knowledge on this, I have no idea how to reverse what I did when I entered
chown -R ec2-user /var/app
chmod -R 755 /var/app
How do I set the permissions back so I can edit files and update plugins via Wordpress admin?
EDIT: I found out that all I did was change ownership of the files to ec2-user. SO I guess my new question is how do I find out what username to use for my WordPress site to give it back ownership of the files?
Fixed:
I wound up adding
echo(exec("whoami"));die();
to the top of my WordPress index.php file to figure out the user. Make sure to remove it once you're done.
Lets say my username wound up being "foo".
After I had the username, I went back into PuTTY, and ran
sudo chown -R foo /var/app
and can now modify files through wordpress again.

Not able to install plugins in Wordpress

I've a wordpress hosted in Rackspace cloud server. The site is working fine. To access the wordpress admin panel i have setup FTP access to the root user. I'm able to access and create files via FTP and the wordpress admin can connect to the server via FTP.
But i'm not able to install new plugins from the wordpress admin panel.I'm getting the following errors.
Downloading install package from https://downloads.wordpress.org/plugin/icon-list.0.3.zip…
Unpacking the package…
Could not create directory.
Return to Plugin Installer
First i thought it was some permission issue. But in the server i've set the permissions 777 to the wordpress project folder.But its still showing the same error.
Is there any configuration change made, to be able to install the wordpress plugins successfully.
Set the write permission for your FTP user.
Read Wordpress file permissions from here Changing_File_Permissions
It's can be also a problem with web hosting configurations. Try the FTP method. Reference here.
Add the following lines in your wp-config.php
define('FS_METHOD', 'ftpext');
define('FTP_USER', 'YOUR FTP LOGIN');
define('FTP_PASS', 'YOUR FTP PASSWORD');
define('FTP_HOST', 'YOUR FTP HOST (without http:// or ftp://)');
define('FTP_SSL', false);
Another way :
Your web server has write permissions, then add this to your wp-config.php file:
define('FS_METHOD', 'direct');
Also, wanted to add that you must NEVER set the wp-content permission or permission of any folder to 777.

No Write Access on Wordpress Folder permissions for Bitnami running on AWS

I recently migrated my Wordpress sites to Bitnami on Amazon Web Services. Everything it up and running from the user's perspective, but I'm struggling with a minor permission issue with the themes folder. When I download (or upload my own) theme, it doesn't have write permissions. Bitnami has this as the default for security purposes but when I had my stuff hosted at GoDaddy, this issue never came up.
The odd time I like to go and edit a theme file directly from Wordpress. I also have a File Manager plugin installed that I'll sometimes use instead of FTP to upload theme files.
I can manually change the permissions, either in FileZilla or using SSH but my curiosity and stubbornness would like to have write permission by default on any themes, new or existing.
Do I need to edit a config file somewhere to make this happen?
You need to connect to your server via SSH and execute the commands below described in order to assign correct permissions definitively:
sudo chmod -R g+w /opt/bitnami/apps/wordpress/htdocs/wp-content
sudo chown -R bitnami:daemon /opt/bitnami/apps/wordpress/htdocs/wp-content
Then check again if your themes works as you expected.
You can read our documentation to clarify all this situation: https://docs.bitnami.com/general/apps/wordpress/

Wordpress plugins it asks for FTP Details

While I am trying to upgrade the wordpress plugins it Asks for FTP Details.
I have added the following to wp-config.php
define('FTP_USER', 'username');
define('FTP_PASS', 'password');
define('FTP_HOST', 'host address');
It has worked fine.
But I have multiple websites working on my virtualmin server. All the wordpress site is having the same wordpress plugin issue. So is there any other fix that could resolve the Issue?
I just found these: link 1 and link 2, where I dug out this:
WordPress asks for your FTP credentials when it can't access the files directly. This is usually caused by PHP running as the apache user (mod_php or CGI) rather than the user that owns your WordPress files (suPHP or FastCGI). Switching over to using suPHP or FastCGI would probably fix it. Of course, if you don't want to mess with that, you can always just put your FTP credentials directly in wp-config.php or use this in the shell:
pae$ cd /var/ww
pae$ sudo chown -R www-data:www-data wordpress
The best way to deal with wordpress installation on apache is to use the secondary user and group to apache which would not cause these issue while updating or installing plugins and using other wordpress functions.
just change your apache config file User and Group to your username and group name
User [yourusername]
Group [yourgroupname]
In wp-config just write
define('FS_METHOD', 'direct');
Are you hosting your WordPress sites on one of those hosts where WordPress asks you to provide FTP details before upgrading itself or upgrading plugins?
So Now WordPress will stop asking you for FTP details Here’s how you can do it
Open your wp-config.php file locate in your wordpress root directory
And copy and past below detail after your database detail block in wp-config.php file
define(“FTP_HOST”, “ftp.yourhost.com”);
define(“FTP_USER”, “ftpusername”);
define(“FTP_PASS”, “ftppassword”);

Install a theme in local machine. Should I need the FTP data connection?

I have just installed wordpress at my localhost for the first time.
I want to install a theme, and it asks me about my FTP username and password.
It says this: "To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host."
I'm wondering if wp is usually directly installed in the production web server or if it could be installed first in a local machine... What should I do?
Add this to your wp-config.php
define('FS_METHOD','direct');
Due to Linux having such a more restrictive file system, this will enable to you write directly to the folder.
This will solve that ftp problem while installing a new plugin or theme.
On OSX, I used the following, and it worked:
sudo chown -R _www:_www {path to wordpress folder}
_www is the user that PHP runs under on the Mac. (You can change this to whatever your PHP install runs under on your specific OS)
(You may also need to chmod some folders too. I had done that first and it didn't fix it. It wasn't until I did the chown command that it worked, so I'm not sure if it was the chown command alone, or a combination of chmod and chown.)
If WordPress asking hostname and connection details for installing plugin and themes, we need to add a function hook in the wp-config.php file in the home directory.
define('FS_METHOD','direct');
for more details refer the page.
https://support.cloudways.com/how-to-resolve-wordpress-asking-for-ftp-credentials-error/
If you're using your local machine as the install location, instead of using the in-app installer (which is now askign you for ftp details), fire up a browser and download the theme directly from the Theme Directory, unzip it into the themes folder at wp-content/themes/name-of-theme. You can then activate the theme from the admin panels.
See also the instructions at http://codex.wordpress.org/Using_Themes.

Resources