Php occ db:add-missing-indices

Hi,

when I execute php occ db:add-missing-indices to add missing indices I get
following error

PHP Parse error: syntax error, unexpected ‘class’ (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or ‘{’ or ‘$’ in /var/www/vhosts//console.php on line 97

I am running on php 7.3 and nextcloud 19.0.2

any help?

This seems to me, that your CLI PHP-Version is a very old one (something 5.4 or so)
Check your CLI PHP version with php -v

The CLI PHP-Version doesn’t need to be the same as on what the Nextcloud aka Webserver is running with.

If you found the corret PHP-Binary with at least PHP 7.3 you can execute the occ command like that

php73 ./occ db:add-missing-indices

This requires, that you are currently in the nextclouds “root” directory where the occ command is located.

Thanks worked like a charm