Plugin/Theme update fails – Add FTP details to wp-config.php
The update cannot be installed because WordPress will be unable to copy some files. This is usually due to inconsistent file permissions.
Permissions-wise, all files should be 644 and all directories should be 755. Nothing higher, nothing lower.
The files should be owned by the same user that PHP runs under, in order to avoid the problem you had with the update.
The solution for this issue is to reset the file permissions on the core files. Provided you have SSH access to your server, the following commands may fix your issue.
Reset the permissions of all files to 664: find /path/to/site/ -type f -exec chmod 644 {} \;
Reset permissions of directories to 755: find /path/to/site/ -type d -exec chmod 755 {} \;
Reset the group to the wordpress group: chgrp -R wordpress /path/to/site/
After running those commands you will be able to successfully update your plugin/themes on your WordPress sites with no further issues.
Or you can try adding the below details to your wp-config.php file.
Note: Do not add this to the end of the file, but just below the database information on the top of the file.
define(‘FS_METHOD’,’direct’);
or
define(‘FTP_USER’, ‘username’); // Your FTP username
define(‘FTP_PASS’, ‘password’); // Your FTP password
define(‘FTP_HOST’, ‘ftp.example.org:21’); // Your FTP URL:Your FTP port