Dans Nextcloud, la page Paramètres > Administration > Vue d’ensemble vous permet d’avoir un bon aperçu des tâches de maintenance à effectuer sur votre installation Nextcloud.
This version of Nextcloud is not compatible with > PHP 7.4
C’est une erreur – et non un avertissement – qui bloque toutes les commandes suivantes dans le terminal. Elle apparaît lorsqu’une version de PHP plus récente est installée sur votre serveur.
Chez moi, par exemple, j’ai PHP 7.4 pour les sites en production et pour Nextcloud mais aussi PHP 8 pour les plateformes de développement.
Voici le message d’erreur:
This version of Nextcloud is not compatible with > PHP 7.4.
You are currently running 8.0.0
Ce message apparaît parce que Nextcloud lance un rapide php -v
pour déterminer la version de PHP installée. Cela ne reconnaît par contre que la version la plus récente installée.
Voici ce que donne la commande :
PHP 8.0.0 (cli) (built: Nov 27 2020 12:26:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.0.0, Copyright (c), by Zend Technologies
Code language: CSS (css)
La solution consiste à modifier manuellement la version retournée par php -v
, à l’aide de la commande update-alternatives
:
update-alternatives --set php /usr/bin/php7.4
Code language: JavaScript (javascript)
Si on relance php -v
, voici le résultat:
PHP 7.4.13 (cli) (built: Nov 28 2020 06:24:59) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies
Code language: CSS (css)
Avec cela, vous êtes parés pour les commandes occ de Nextcloud.
Nextcloud reste bloqué en mode maintenance
Cela peut arriver lors d’une mise à jour, pour diverses raisons.
Solution 1: avec la commande occ
cd /home/www/nextcloud
sudo -u www-data php ./occ maintenance:mode --off
Solution 2: éditer le fichier config.php
1. Editez le fichier config.php:
nano /home/www/nextcloud/config/config.php
2. trouvez:
'maintenance' => true,
Code language: PHP (php)
3. remplacez par:
'maintenance' => false,
Code language: PHP (php)
Enregistrez le fichier, l’assistant de mise à jour est alors capable de reprendre là où il s’était arrêté, automatiquement.
Réparer la base de données
Vous pouvez lancer cette commande pour réparer la base de données Nextcloud en cas de besoin:
sudo -u www-data php occ maintenance:repair
Code language: CSS (css)
Résultat:
- Repair MySQL collation
- All tables already have the correct collation -> nothing to do
- Repair mime types
- Clean tags and favorites
- 0 tags of deleted users have been removed.
- 0 tags for delete files have been removed.
- 0 tag entries for deleted tags have been removed.
- 0 tags with no entries have been removed.
- Repair invalid shares
- Move .step file of updater to backup location
- Add move avatar background job
- Repair step already executed
- Add preview cleanup background jobs
- Fix potential broken mount points
- No mounts updated
- Repair language codes
- Install new core bundle components
- Add log rotate job
- Clear frontend caches
- Image cache cleared
- SCSS cache cleared
- JS cache cleared
- Clear every generated avatar on major updates
- Add preview background cleanup job
- Queue a one-time job to cleanup old backups of the updater
- Cleanup invalid photocache files for carddav
- Add background job to cleanup login flow v2 tokens
- Remove potentially over exposing share links
- No need to remove link shares.
- Clear access cache of projects
- Reset generated avatar flag
- Keep legacy encryption enabled
- Check encryption key format
- Remove old dashboard app config data
- Add job to cleanup the bruteforce entries
- Queue a one-time job to check for user uploaded certificates
- Repair DAV shares
- Add background job to set the lookup server share state for users
- Upgrading Circles App
- (Circles) Migrating to 22
0 [>---------------------------]
0 [->--------------------------]
8/8 [============================] 100%
- Fix component of birthday calendars
- 3 birthday calendars updated.
- Regenerating birthday calendars to use new icons and fix old birthday events without year
- Repair step already executed
- Fix broken values of calendar objects
0 [---------------->-----------]
- Registering building of calendar search index as background job
- Repair step already executed
- Register building of social profile search index as background job
- Registering background jobs to update cache for webcal calendars
- Added 0 background jobs to update webcal calendars
- Registering building of calendar reminder index as background job
- Repair step already executed
- Clean up orphan event and contact data
- 0 events without a calendar have been cleaned up
- 0 properties without an events have been cleaned up
- 0 changes without a calendar have been cleaned up
- 0 cached events without a calendar subscription have been cleaned up
- 0 changes without a calendar subscription have been cleaned up
- 0 contacts without an addressbook have been cleaned up
- 0 properties without a contact have been cleaned up
- 0 changes without an addressbook have been cleaned up
- Remove activity entries of private events
- Removed 0 activity entries
- Restore default tags that are missing
- Looking up default tags
- 1 accounts to check found
1/1 [============================] 100%
- Add a generated message-id to all Mail messages that have none
- Looking up messages without a message-id
- Purify and migrate collected mail addresses
1/1 [============================] 100%
- Insert background jobs for all accounts
1/1 [============================] 100%
- Make Mail itinerary extractor executable
- Create or update provisioned Mail accounts
- 0 accounts provisioned
- Clean up meta table
- Update OAuth token expiration times
- Switches from default updater server to the customer one if a valid subscription is available
- Repair step already executed
- Add background job to check for backup codes
- Populating added database structures for workflows
Code language: JavaScript (javascript)
Ajouter les types MIME manquants
Vous pouvez ajouter les types MIME manquants à la base de donnée avec cette commande:
sudo -u www-data php occ maintenance:mimetype:update-db
Code language: CSS (css)
Résultat:
Added mimetype "video/3gpp" to database
Added mimetype "application/x-7z-compressed" to database
Added mimetype "application/msaccess" to database
Added mimetype "application/illustrator" to database
Added mimetype "application/vnd.android.package-archive" to database
Added mimetype "image/x-dcraw" to database
Added mimetype "video/x-msvideo" to database
Added mimetype "text/x-shellscript" to database
Added mimetype "application/x-msdos-program" to database
Added mimetype "application/x-blender" to database
Added mimetype "application/x-bin" to database
Added mimetype "image/bmp" to database
Added mimetype "image/bpg" to database
Added mimetype "application/x-bzip2" to database
Added mimetype "application/comicbook+7z" to database
Added mimetype "application/comicbook+ace" to database
Added mimetype "application/comicbook+rar" to database
Added mimetype "application/comicbook+tar" to database
Added mimetype "application/comicbook+truecrypt" to database
Added mimetype "application/comicbook+zip" to database
Added mimetype "text/x-c" to database
Added mimetype "application/coreldraw" to database
Added mimetype "application/java" to database
Added mimetype "application/cmd" to database
Added mimetype "text/x-c++src" to database
Added mimetype "text/csv" to database
Added mimetype "application/x-cbr" to database
Added mimetype "application/x-deb" to database
Added mimetype "application/msword" to database
Added mimetype "application/vnd.ms-word.document.macroEnabled.12" to database
Added mimetype "application/vnd.openxmlformats-officedocument.wordprocessingml.template" to database
Added mimetype "video/dv" to database
Added mimetype "application/vnd.ms-fontobject" to database
Added mimetype "application/epub+zip" to database
Added mimetype "application/postscript" to database
Added mimetype "application/x-ms-dos-executable" to database
Added mimetype "application/x-fictionbook+xml" to database
Added mimetype "video/x-flv" to database
Added mimetype "image/gif" to database
Added mimetype "application/gpx+xml" to database
Added mimetype "text/x-h" to database
Added mimetype "image/heif" to database
Added mimetype "text/html" to database
Added mimetype "text/calendar" to database
Added mimetype "text/impress" to database
Added mimetype "text/x-java-source" to database
Added mimetype "image/jp2" to database
Added mimetype "application/x-kdbx" to database
Added mimetype "application/x-iwork-keynote-sffkey" to database
Added mimetype "application/km" to database
Added mimetype "application/vnd.google-earth.kml+xml" to database
Added mimetype "application/vnd.google-earth.kmz" to database
Added mimetype "application/x-krita" to database
Added mimetype "text/x-ldif" to database
Added mimetype "application/vnd.lotus-wordpro" to database
Added mimetype "video/mp2t" to database
Added mimetype "audio/m4b" to database
Added mimetype "video/x-matroska" to database
Added mimetype "application/x-freemind" to database
Added mimetype "application/x-mobipocket-ebook" to database
Added mimetype "video/mpeg" to database
Added mimetype "application/x-msi" to database
Added mimetype "video/MP2T" to database
Added mimetype "application/x-iwork-numbers-sffnumbers" to database
Added mimetype "application/vnd.oasis.opendocument.formula" to database
Added mimetype "application/vnd.oasis.opendocument.graphics" to database
Added mimetype "application/vnd.oasis.opendocument.presentation" to database
Added mimetype "application/vnd.oasis.opendocument.spreadsheet" to database
Added mimetype "video/ogg" to database
Added mimetype "application/msonenote" to database
Added mimetype "application/font-sfnt" to database
Added mimetype "application/x-iwork-pages-sffpages" to database
Added mimetype "application/x-font" to database
Added mimetype "application/x-php" to database
Added mimetype "application/x-perl" to database
Added mimetype "application/vnd.ms-powerpoint" to database
Added mimetype "application/vnd.ms-powerpoint.template.macroEnabled.12" to database
Added mimetype "application/vnd.openxmlformats-officedocument.presentationml.template" to database
Added mimetype "application/vnd.ms-powerpoint.addin.macroEnabled.12" to database
Added mimetype "application/vnd.ms-powerpoint.slideshow.macroEnabled.12" to database
Added mimetype "application/vnd.openxmlformats-officedocument.presentationml.slideshow" to database
Added mimetype "application/vnd.ms-powerpoint.presentation.macroEnabled.12" to database
Added mimetype "application/vnd.openxmlformats-officedocument.presentationml.presentation" to database
Added mimetype "application/x-photoshop" to database
Added mimetype "text/x-python" to database
Added mimetype "application/x-rar-compressed" to database
Added mimetype "text/reveal" to database
Added mimetype "application/rss+xml" to database
Added mimetype "text/rtf" to database
Added mimetype "application/sgf" to database
Added mimetype "image/sgi" to database
Added mimetype "application/x-shockwave-flash" to database
Added mimetype "application/x-tar" to database
Added mimetype "application/x-compressed" to database
Added mimetype "application/vnd.garmin.tcx+xml" to database
Added mimetype "application/x-tex" to database
Added mimetype "image/tga" to database
Added mimetype "image/tiff" to database
Added mimetype "text/vcard" to database
Added mimetype "video/dvd" to database
Added mimetype "application/vnd.visio" to database
Added mimetype "application/vnd.ms-visio.drawing.macroEnabled.12" to database
Added mimetype "application/vnd.ms-visio.drawing" to database
Added mimetype "application/vnd.ms-visio.stencil.macroEnabled.12" to database
Added mimetype "application/vnd.ms-visio.stencil" to database
Added mimetype "application/vnd.ms-visio.template.macroEnabled.12" to database
Added mimetype "application/vnd.ms-visio.template" to database
Added mimetype "video/webm" to database
Added mimetype "image/webp" to database
Added mimetype "application/font-woff" to database
Added mimetype "application/vnd.wordperfect" to database
Added mimetype "video/x-ms-wmv" to database
Added mimetype "application/x-gimp" to database
Added mimetype "application/vnd.ms-excel" to database
Added mimetype "application/vnd.ms-excel.addin.macroEnabled.12" to database
Added mimetype "application/vnd.ms-excel.sheet.binary.macroEnabled.12" to database
Added mimetype "application/vnd.ms-excel.sheet.macroEnabled.12" to database
Added mimetype "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" to database
Added mimetype "application/vnd.ms-excel.template.macroEnabled.12" to database
Added mimetype "application/vnd.openxmlformats-officedocument.spreadsheetml.template" to database
Added mimetype "application/vnd.xmind.workbook" to database
Added mimetype "application/xml" to database
Added mimetype "application/yaml" to database
Added mimetype "application/zip" to database
Added mimetype "application/internet-shortcut" to database
Added 125 new mimetypes
Updated 0 filecache rows
Code language: JavaScript (javascript)
La base de données a quelques index manquants
Voici le message d’avertissement complet:
La base de données a quelques index manquant. L’ajout d’index dans de grandes tables peut prendre un certain temps. Elles ne sont donc pas ajoutées automatiquement.
En exécutant “occ db:add-missing-indices”, ces index manquants pourront être ajoutés manuellement pendant que l’instance continue de tourner.
Une fois les index ajoutés, les requêtes sur ces tables sont généralement beaucoup plus rapides.
La solution:
cd /home/www/nextcloud
sudo -u www-data php ./occ db:add-missing-indices
Résultat:
Check indices of the share table.
Check indices of the filecache table.
Check indices of the twofactor_providers table.
Check indices of the login_flow_v2 table.
Check indices of the whats_new table.
Check indices of the cards table.
Adding cards_abiduri index to the cards table, this can take some time…
cards table updated successfully.
Check indices of the cards_properties table.
Check indices of the calendarobjects_props table.
Check indices of the schedulingobjects table.
Check indices of the oc_properties table.
Code language: JavaScript (javascript)
Il manque des clés primaires dans la base de données
Voici le message d’avertissement complet :
Il manque des clés primaires dans la base de données. En raison du fait que l’ajout de clés primaires sur les grandes tables peut prendre un certain temps, elles n’ont pas été ajoutées automatiquement.
En exécutant “occ db:add-missing-primary-keys”, ces clés primaires manquantes peuvent être ajoutées manuellement pendant que l’instance continue de fonctionner.
La solution:
cd /home/www/nextcloud
sudo -u www-data php ./occ db:add-missing-primary-keys
Résultat:
Check primary keys.
Adding primary key to the federated_reshares table, this can take some time…
federated_reshares table updated successfully.
Adding primary key to the systemtag_object_mapping table, this can take some time…
systemtag_object_mapping table updated successfully.
Adding primary key to the comments_read_markers table, this can take some time…
comments_read_markers table updated successfully.
Adding primary key to the collres_resources table, this can take some time…
collres_resources table updated successfully.
Adding primary key to the collres_accesscache table, this can take some time…
collres_accesscache table updated successfully.
Adding primary key to the filecache_extended table, this can take some time…
filecache_extended table updated successfully.
Code language: JavaScript (javascript)
Certaines colonnes de la base de données n’ont pas été converties en big int
Voici le message d’avertissement complet :
Certaines colonnes de la base de données n’ont pas été converties en big int. Changer le type de colonne dans de grandes tables peu prendre beaucoup de temps, elles n’ont donc pas été converties automatiquement.
En exécutant ‘occ db:convert-filecache-bigint’ ces changements en suspens peuvent être déclenchés manuellement. Cette opération doit être exécutée pendant que l’instance est hors ligne.
Voici la solution:
cd /home/www/nextcloud
sudo -u www-data php ./occ maintenance:mode --on
sudo -u www-data php ./occ db:convert-filecache-bigint
sudo -u www-data php ./occ maintenance:mode --off
Résultat:
Following columns will be updated:
federated_reshares.share_id
filecache_extended.fileid
share_external.id
share_external.parent
This can take up to hours, depending on the number of files in your instance!
Continue with the conversion (y/n)? [n] y
Code language: PHP (php)
Erreurs Memcache et APCu
Après certaines mises à jour de PHP, j’ai pu obtenir dans certains cas des erreurs de cache local avec APC:
An unhandled exception has been thrown:
OC\HintException: [0]: Memcache \OC\Memcache\APCu not available for local cache (Is the matching PHP module installed and enabled?)
Code language: JavaScript (javascript)
La solution est toute simple, il suffit d’éditer le fichier /etc/php/7.4/cli/conf.d/20-apcu.ini
de la configuration cli
de votre version de PHP. Je prends PHP7.4 comme exemple ici:
nano /etc/php/7.4/cli/conf.d/20-apcu.ini
Vous n’avez plus qu’à ajouter cette ligne pour activer APCu pour le mode cli
de PHP, celui qu’utilise nextcloud:
apc.enable_cli=1
Activer le support SVG pour l’extension php-imagick
À partir de la version 21, Nextcloud affiche un avertissement qui dit que l’extension php-imagick
ne possède pas le support pour les fichiers SVG. Si c’est le cas sur votre installation, installez ces paquets:
apt install php-imagick imagemagick
Résultat:
The following NEW packages will be installed:
imagemagick imagemagick-6.q16 libdjvulibre-text libdjvulibre21 libilmbase24 libmagickcore-6.q16-6-extra libnetpbm10 libopenexr24 libwmf0.2-7 netpbm php-imagick
Code language: CSS (css)
Installer les paquets PHP manquants
Cette instance ne dispose pas de plusieurs modules PHP recommandés. Il est recommandé de les installer pour améliorer les performances, et la compatibilité : bz2
apt install php-bz2
La gestion des fichiers .mjs par le serveur
Si vous obtenez ce message :
Votre serveur web ne gère pas les fichiers `.mjs` utilisant le type MIME JavaScript. Cela perturbe certaines applications en empêchant les navigateurs d’exécuter les fichiers JavaScript. Vous devez configurer votre serveur web pour qu’il gère les fichiers `.mjs` avec les types MIME `text/javascript` ou `application/javascript`.
Alors, c’est que vous devez ajouter une nouvelle ligne dans votre fichier de configuration mime types:
nano /etc/nginx/snippets/mime-types.conf
Ajoutez cette ligne dans votre configuration :
types {
application/javascript mjs;
}
Relancez ensuite nginx
.
Le module PHP OPcache n’est pas correctement configuré
Le module PHP OPcache n’est pas correctement configuré. Le tampon mémoire des chaînes internes OPcache est presque plein. Pour vous assurer que les chaînes répétitives peuvent être mise en cache, il est recommandé de définir la variable « opcache.interned_strings_buffer » de votre fichier de configuration PHP à une valeur supérieure à « 64 »
nano /etc/php/8.3/fpm/conf.d/60-custom.ini
Et on modifie :
opcache.interned_strings_buffer = 256
Vous n’avez plus qu’à relancer php-fpm.
Server has no maintenance window start time configured
Server has no maintenance window start time configured. This means resource intensive daily background jobs will also be executed during your main usage time. We recommend to set it to a time of low usage, so users are less impacted by the load caused from these heavy tasks.
cd /home/www/nextcloud
sudo -u www-data php ./occ config:system:set maintenance_window_start --type=integer --value=1
Code language: JavaScript (javascript)
Voilà pour les erreurs communes que j’ai déjà rencontrées. J’espère que cela peut vous aider si vous y êtes aussi confrontés un jour !
Recherchez-vous un expert WordPress ou WooCommerce sur qui vous pouvez compter? Ne cherchez plus.
Bonjour,
Pour les index et clef primaire manquants, pourriez vous SVP nous donner les requete SQL à passer? En effet, je n’ai pas les accès SSH et ne peut donc pas exécuter les lignes indiquées.
Merci !
Bonjour,
Pour les indices manquants:
Pour la clé primaire:
Notez que d’autres tables peuvent être concernées, tout dépend de votre version de Nextcloud et des tables concernées par votre mise à jour.
Bonjour
Merci bcp pour avoir mis les requetes SQL ! J’ai enfin pu corriger les bases de données.
J’ai toutefois encore quelques soucis sur mon instance :
* Des index manquants
* Colonnes de la base de données n’ont pas été converties en big int
Lorsque je veux utiliser les commandes OCC via SSH, mon syno répond que la version de PHP détecté est 5.6 alors que je suis sur un 7.4 (il s’agit d’un bug) et je ne parviens donc pas à utiliser les commandes.
La solution d’executer les commandes SQL m’a déja bcp aidé, mais pourriez vous me donner les commandes a utiliser pour ces 2 items pour tout pouvoir corriger ?
Merci :-)
Mise à jour de l’article avec les commandes maintenance supplémentaires.