If you still have the old installation I would recommend to perform the migration in proper way as described in Migrating to a different server — Nextcloud latest Administration Manual latest documentation
see 101: backup what and why (not how) to learn which data is important.
please review Preparing PHP — Nextcloud latest Administration Manual latest documentation