Cannot write into “config” directory

Can someone help me with this pls?
I cant use occ in my nextcloud

Tell us the output of command

ls -l config

in your nextcloud directory.

So do you run the occ command as user www-data? Like

sudo -u www-data php occ …

and still get that error?

yes it stills get that error so help me pls

I noticed your nextcloud directory is in your home directory. Give me the same command as above, but

ls -l ~/nextcloud

If the nextcloud is not owned by www-data, change it:

sudo chown -R www-data:www-data ~/nextcloud

It’s generally better to have web services in the /var/www directory, like