Tip:NextCloud 15.0.2 DS218+ php7.0.33 occ db:add-missing-indices uncaught error [SOLVED]

Sorry for the english :slight_smile:

After Update to version 15.0.2 and php7 on a DS218+ there where some configuration problems.
The “missing indices” problems shoud be solved by execute “occ db:add-missing-indices”. But unfortunately occ didn’t work with php7.
Logfile […] Uncaught Doctrine\DBAL\DBALExeption:Failed to connect to database: An exeption occured in driver:[…]

I tried ( new php.ini, and a lot more… ) since days but the only thing worked was this site:

short translation for the few non-germans :wink: :

The Author says: that the are not all extensions available in the Comand Line Interface (CLI) of php7.

search the folder ‘/var/packages/WebStation/etc/php_profile/’
If you have one php version installed - there is only one subfolder (with a lot of characters and numbers)
else (maybe you have installed php5.XX too) there are more subfolders.
In each of them there will be a subfolder conf.d with a file called ‘user_settings.ini’
‘/var/packages/WebStation/etc/php_profile/<CHARACTERS+NUMBERS>/conf.d/user_settings.ini’

You have to find out which one is for php7 - to compare the extensions in the user_settings.ini with the extensions selected in package-manager of the DS218 is maybe one way.

if you know the right folder go back to root and create a bash script-file ( i prefer ‘nano’ not ‘vi’ “sudo nano php7.sh” ) then insert into it
"
#!/bin/bash
PHP_INI_SCAN_DIR=.:/usr/local/etc/php70/:/var/packages/WebStation/etc/php_profile/<CHARS+NUMBERS>/conf.d/
export PHP_INI_SCAN_DIR
php70 $*
"
save it and then change the owner:group [ sudo chown http:http php7.sh ]
and the permissions [ sudo chmod 764 php7.sh ]
then try to execute it [ sudo ./php7.sh -i ]
If you see the same output like phpinfo() its all right…

Now you should be able to execute all occ comands in the shell like this example when the file is in the root
directory else the path has to be adjusted.
sudo -u http /php7.sh occ db:add-missing-indices

sua