Lost Password Raspberry Pi Nextcloud

I setup Nextcloud on a raspberry pi, but forgot the password.

Tried running this on the raspberry pi terminal in raspbian

sudo -u www-data php /var/www/nextcloud/occ user:resetpassword admin

But it says it can’t open it.

Any suggestions?

Please post the correct error.
Test that all exists. Use any linux user:

www-data?
id www-data

occ?
ls -l /var/www/html/nextcloud/occ

php?
which php

DISCLAIMER: This e-mail transmission and any attachments that accompany it may contain information that is privileged, confidential or otherwise exempt from disclosure under applicable law and is intended solely for the use of the individual(s) to whom it was intended to be addressed. If you have received this e-mail by mistake, or you are not the intended recipient, any disclosure, dissemination, distribution, copying or other use or retention of this communication or its substance is prohibited. If you have received this communication in error, please immediately reply to the author via e-mail that you received this message by mistake and also permanently delete the original and all copies of this e-mail and any attachments from your computer.

Please note that coverage cannot be bound or altered by sending an email. You must speak with or receive written confirmation from a licensed representative of our firm to put coverage in force or make changes to your existing program. Thank you.

Sorry. I do not understand.
If you have problems to post it you can send me a private message with details.

Which password? For NC, NCP, or Pi?

In NCP you can use ncp-config (terminal) or ncp-web:4443 to manage passwords with
nc-admin for NC
nc-password for NCP

As documented in FAQ