Whenever you use the WordPress admin panel to install, upgrade, or delete plugins, WordPress must make changes to files on their filesystem.Before making any changes, WordPress first checks to see whether or not it has access to directly manipulate the file system.
If WordPress does not have the necessary permissions to modify the filesystem directly, you will be asked for FTP credentials so that WordPress can try to do what it needs to via FTP.
HOW TO RESOLVE IT?
In order to fix this issue, you will need to make sure that the scripts which need to write to the filesystem are owned by the same user that apache is running as.
WordPress asks for your FTP credentials when it can’t access the files directly. This isusually caused by PHP running as the apache user (mod_php or CGI) rather than the user that owns your WordPress files (suPHP or FastCGI). Switching over to using suPHP or FastCGI would probably fix it. Of course, if you don’t want to mess with that, you can always just put your FTP credentials directly in wp-config.php
like this:
[code]
define( ‘FTP_USER’, ‘username’ );
define( ‘FTP_PASS’, ‘password’ );
define( ‘FTP_HOST’, ‘ftp.example.org:21’ );
[/code]
OR You can fix it by using this command
[code]
viva-desktop$ cd /var/ww
viva-desktop$ sudo chown -R www-data:www-data wordpress
[/code]