Wordpress plugins it asks for FTP Details - wordpress

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”);

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 add plugins

We have a blog setup on WordPress and our server is a linode instance which we connect through ssh.
Now when I am trying to add yoast plugin it is asking me for FTP credentials and when I am entering them still it is not connecting.
Please advise on this as we are not able to add plugins to our site.
This is a permissions issue with your server, run the following command in your SSH terminal:
sudo chown -R www-data:www-data /var/www
This will grant your WordPress sites the permanent ability to add/update plugins and themes.
It might be Permission issue. Try these simple steps:
1: Open Filezilla and after entering FTP Access, connect to directory
where your wordpress files exist.
Now right click on the Parent Folder of your wordpress installation and click on "Change Permission" Now enable Read/Write/Execute.
Now try again with Yoast Plugin. It should Work.
https://codex.wordpress.org/Changing_File_Permissions
Let us know if it worked.

wordpress asks for ftp password while installing plugins

I have a centos with user anamika with ftp loging.
I create wordpress folder loging with user anamika in webroot directory. User anamika has apache as primary group. The create folder gets user of anmika:apache when create.
When I try to install plugin it asks for ftp login.
When I changes user from anamika:apache to apache:anamika it works fine.
Please suggest a way to solve this user issue.
I checked following suggestion and wordpress blogs but didn't worked.
Wordpress plugins it asks for FTP Details
Wordpress asking for my FTP credentials to install plugins
Installing plugin for wordpress website hosted locally is asking for ftp details
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');
You can use Paste the following code to your wp-config.php file,
preferably just below every other line of code to install plugin without ftp details...
define('FS_METHOD','direct');
The issue was with the permission of the user apache. I changed the user and group of the apache in httpd.conf file to the ftp user and it solved the issue.
Changed User apache Group apache to User anamika Group anamika

Problems importing Wordpress into Amazon Web Service (EC2)

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.

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