Permissions working but not working

Make sure the user running on behalf of the webserver’s PHP process has ownership permissions on /path/to/wordpress

Example

For Ubuntu 18.04 running Apache2

# Go to wordpress installation root directory
cd /path/to/wordpress

# Give ownership to Apache2's PHP process
sudo chown www-data:www-data .

# Apply files and directories permissions
sudo find . -type f -exec chmod 664 {} +
sudo find . -type d -exec chmod 775 {} +
sudo chmod 644 wp-config.php