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!

4
  • Is your localhost a Linux machine?
    – user8158124
    Jun 27, 2017 at 19:39
  • I got a mac OSX Sierra Jun 27, 2017 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.
    – user8158124
    Jun 27, 2017 at 19:50
  • It's okay thank you, I've found the solution as you see I added the answer. Thanks by the way :) Jun 27, 2017 at 20:00

4 Answers 4

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.

2
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.

6

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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