9
votes

I can't upload WooCommerce .zip file and install the plugin on the local host. Every time I click install button Wordpress asking for connection information for the FTP credentials like this pic: enter image description here

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

4
Is your localhost a Linux machine? - user8158124
I got a mac OSX Sierra - Ali.Ghodrat
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
It's okay thank you, I've found the solution as you see I added the answer. Thanks by the way :) - Ali.Ghodrat

4 Answers

19
votes

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.

5
votes

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.

5
votes

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

1
votes

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