11

I can't upload a WooCommerce .zip file and install the plugin on the local host. Every time I click install button, WordPress is asking for connection information for the FTP credentials like this picture:

Enter image description here

Even though I entered localhost for the hostname and admin as username, it doesn't work!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ali.Ghodrat
  • 3,348
  • 3
  • 31
  • 31
  • Is your localhost a Linux machine? –  Jun 27 '17 at 19:39
  • I got a mac OSX Sierra – Ali.Ghodrat Jun 27 '17 at 19:41
  • 2
    I no nothing about Macs but WordPress will usually directly install files and only uses FTP when it does not have write access to the install directory. Does the process running the WordPress server have write access to your plugin directory? You can avoid using FTP if WordPress can directly write to your plugin directory. Sorry, don't know how to do this on a Mac. –  Jun 27 '17 at 19:50
  • It's okay thank you, I've found the solution as you see I added the answer. Thanks by the way :) – Ali.Ghodrat Jun 27 '17 at 20:00

4 Answers4

21

Try:

chmod 777 /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/plugins/
chmod 777 /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/

Then add these to wp-config.php:

/** Add here*/
define('FS_METHOD','direct');
define("FTP_HOST", "localhost");
define("FTP_USER", “my_wordpress_user”);
define("FTP_PASS", “password”);
/** To here*/

In the line above, my_wordpress_user and password are the ones used in wordpress.

MAPK
  • 5,635
  • 4
  • 37
  • 88
  • 4
    Using `chmod 777` to fix permissions issue is a lack of understanding the real problem. See a more detailed explanation here: https://stackoverflow.com/questions/640409/can-i-install-update-wordpress-plugins-without-providing-ftp-access#answer-5650020 and also @Sebastian Schmid comment here: https://stackoverflow.com/questions/17922644/wordpress-asking-for-my-ftp-credentials-to-install-plugins/18634804#18634804 – 4wk_ Jan 30 '19 at 10:07
  • Thank you so much, Work for me – Karol Idarmi May 13 '20 at 23:41
6

Ok I solved the problem by editing wp-config.php in the htdocs folder where I installed Wordpress -> like image 1:

image1

I added the below lines to the wp-config.php like image 2

define('FS_METHOD','direct');
define("FTP_HOST", "localhost");
define("FTP_USER", "admin");
define("FTP_PASS", "1234");

image2

The username and password is the same as the username pass when I installed the Wordpress during the installation.

Ali.Ghodrat
  • 3,348
  • 3
  • 31
  • 31
5

Just add define('FS_METHOD','direct'); into your wp-config.php.

Darsh khakhkhar
  • 666
  • 5
  • 15
1

Recommanded:

If you are using centos:

//Set www to 777
# chmod -R 777 /var/www/html
// Change the owner to apache
# chown -R apache:apache /var/www/html
// Restart httpd
# systemctl restart httpd

Not recommanded but works:

Add this line in wp-config.php

define( 'FS_METHOD', 'direct' );
Abdelhadi Abdo
  • 392
  • 2
  • 9