I am getting this error even after running chmod -R 755 wp-config.php "FTP credentials don't allow to write to file /var/www/html/wp-config.php"
chmod -R 755 wp-config.php
sudo chown -R apache:apache /var/www/html