Wordpress FTP connection setting for localhost to upload and install WooCommerce

怎甘沉沦 提交于 2019-12-04 13:31:20

问题


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:

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


回答1:


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:


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

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

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




回答3:


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




回答4:


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


来源:https://stackoverflow.com/questions/44788193/wordpress-ftp-connection-setting-for-localhost-to-upload-and-install-woocommerce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!