I followed Failed to connect to FTP Server 127.0.0.1/:21
And was able to solve that problem. But now when I try to upload the theme then I get username and password failure.
I have added following lines in wp-config.php
define( 'FS_METHOD', 'ftpext' );
define( 'FTP_BASE', '/var/www/wordpress/' );
define( 'FTP_CONTENT_DIR', '/var/www/wordpress/wp-content/' );
define( 'FTP_PLUGIN_DIR ', '/var/www/wordpress/wp-content/plugins/' );
define( 'FTP_USER', 'username' );
define( 'FTP_PASS', 'password' );
define( 'FTP_HOST', 'localhost' );
define( 'FTP_SSL', false );
How I can resolve this problem?
UPDATE:
I tried this link and removed all values for ftp which are in wp-config.php
But still same error.
if you do not want to (or you cannot) change permissions on wp-content so your web server has write permissions, then add this to your wp-config.php file:
Back up the config file before making a change;
and then edit vsftpd.conf (with vi or nano)
Then make the following change
Save your change and restart the ftp server (if you use nano hit CTRL+O & enter to save then CTRL+X to exit)
NO, this is only because of the owner/permission of your folder where wordpress files are present. Please check the folder permission, if that is 0755 then replace it with 0777 by using
chmod 777 -R FOLDERNAME
and try to upload, After this if will get again same issue change the folder owner by using
chown www-data FOLDERNAME
For example in your case the folder name is wordpress then use the following commands for changing permisssion/owner
I believe this will work for you.
Also you can define FS_METHOD as direct in wp-config.php so you will not get FTP detials at the time of installation of Theme/Plugin.
Thanks