After upgrading Debian9 Nextcloud is down! (php trouble?)

Hello,

After three hours for looking a solution a realy need some help.
I update my Debian9 server with “apt-get upgrade” and now my nextcloud URL answers (apache based webserver):
Internal Server Error The server encountered an internal error and was unable to complete your request. Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report. More details can be found in the server log.

In the log file, the error messages are not easy to understand :frowning: but every connection there are this message:
{"reqId":"8f4P2cjsEHUW3vikIAn3","level":3,"time":"2021-05-01T07:37:48+00:00","remoteAddr":"192.168.0.254","user":"--","app":"remote","method":"GET","url":"/nextcloud/status.php","message":{"Exception":"OC\\HintException","Message":"Memcache \\OC\\Memcache\\APCu not available for local cache","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Server.php","line":674,"function":"__construct","class":"OC\\Memcache\\Factory","type":"->","args":["f3ce8c7144e6bedd8bd187a9d18fd1fd",{"__class__":"OC\\Log"},"\\OC\\Memcache\\APCu","\\OC\\Memcache\\APCu",null]},{"file":"/var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php","line":118,"function":"OC\\{closure}","class":"OC\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/ServerContainer.php","line":124,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["OC\\Memcache\\Factory"]},{"file":"/var/www/nextcloud/lib/private/Server.php","line":1704,"function":"query","class":"OC\\ServerContainer","type":"->","args":["OC\\Memcache\\Factory"]},{"file":"/var/www/nextcloud/lib/private/Server.php","line":856,"function":"getMemCacheFactory","class":"OC\\Server","type":"->","args":[]},{"file":"/var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php","line":118,"function":"OC\\{closure}","class":"OC\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/ServerContainer.php","line":124,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["OC\\App\\AppManager"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":163,"function":"query","class":"OC\\ServerContainer","type":"->","args":["OC\\App\\AppManager"]},{"file":"/var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php","line":114,"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/ServerContainer.php","line":124,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["OCP\\App\\IAppManager"]},{"file":"/var/www/nextcloud/lib/private/Server.php","line":1894,"function":"query","class":"OC\\ServerContainer","type":"->","args":["OCP\\App\\IAppManager"]},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":347,"function":"getAppManager","class":"OC\\Server","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":114,"function":"getEnabledApps","class":"OC_App","type":"::","args":[]},{"file":"/var/www/nextcloud/lib/base.php","line":648,"function":"loadApps","class":"OC_App","type":"::","args":[["session"]]},{"file":"/var/www/nextcloud/lib/base.php","line":1094,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/nextcloud/status.php","line":37,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Memcache/Factory.php","Line":98,"Hint":"Is the matching PHP module installed and enabled?","CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows) mirall/3.1.3stable-Win64 (build 20210218) (Nextcloud)","version":"19.0.4.2"} {"reqId":"8f4P2cjsEHUW3vikIAn3","level":3,"time":"2021-05-01T07:37:48+00:00","remoteAddr":"192.168.0.254","user":"--","app":"PHP","method":"GET","url":"/nextcloud/status.php","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at /var/www/nextcloud/3rdparty/patchwork/utf8/src/Patchwork/Utf8/Bootup/intl.php#18","userAgent":"Mozilla/5.0 (Windows) mirall/3.1.3stable-Win64 (build 20210218) (Nextcloud)","version":"19.0.4.2"}

I understand a trouble with ““Memcache \OC\Memcache\APCu not available for local cache””

So I check in config.php but Memcache is available:
'memcache.local' => '\\OC\\Memcache\\APCu',

Then, I tried to repair the installation in command line:
sudo -u www-data php occ maintenance:mode --off
But, I received the message:
This version of Nextcloud is not compatible with > PHP 7.4.<br/>You are currently running 8.0.3.

So, I supposed a php version trouble:

  • info.php in my website home page report : " PHP Version 7.3.27-9+0~20210227.82+debian9~1.gbpa4a3d6"
  • php -v command report: “PHP 8.0.3 (cli) (built: Mar 5 2021 08:36:11) ( NTS )”

I doesn’t understand if i’m using 7.3, 7.4 or 8.0.3 version but I tried to force 7.4 version without success:
The command sudo a2enmod php7.4 reports:

Considering dependency mpm_prefork for php7.4:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.4:
Module php7.4 already enabled

And the command, sudo -u www-data php7.4 /var/www/nextcloud/occ maintenance:mode --off reports:
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: could not find driver in /var/www/nextcloud/lib/private/DB/Connection.php:67
Stack trace:
#0 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(889): OC\DB\Connection->connect()
#1 /var/www/nextcloud/lib/private/DB/Connection.php(194): Doctrine\DBAL\Connection->executeQuery()
#2 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(200): OC\DB\Connection->executeQuery()
#3 /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(216): Doctrine\DBAL\Query\QueryBuilder->execute()
#4 /var/www/nextcloud/lib/private/AppConfig.php(331): OC\DB\QueryBuilder\QueryBuilder->execute()
#5 /var/www/nextcloud/lib/private/AppConfig.php(109): OC\AppConfig->loadConfigValues()
#6 /var/www/nextcloud/lib/private/AppConfig.php(287): OC\AppConfig->getApps()
#7 /var/www/nextcloud/lib/private/legacy/OC_App.php(883): OC\AppConfig->getValues()
#8 /var/www/nextcloud/lib/private/Server.php(665): OC_App::getAppVersions()
#9 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC{closure}()
#10 /var/www/nextcloud/lib/private/ServerContainer.php(124): Pimple\Container->offsetGet()
#11 /var/www/nextcloud/lib/private/Server.php(1704): OC\ServerContainer->query()
#12 /var/www/nextcloud/lib/private/Server.php(856): OC\Server->getMemCacheFactory()
#13 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC{closure}()
#14 /var/www/nextcloud/lib/private/ServerContainer.php(124): Pimple\Container->offsetGet()
#15 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(163): OC\ServerContainer->query()
#16 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}()
#17 /var/www/nextcloud/lib/private/ServerContainer.php(124): Pimple\Container->offsetGet()
#18 /var/www/nextcloud/lib/private/Server.php(1894): OC\ServerContainer->query()
#19 /var/www/nextcloud/lib/private/legacy/OC_App.php(347): OC\Server->getAppManager()
#20 /var/www/nextcloud/lib/private/legacy/OC_App.php(114): OC_App::getEnabledApps()
#21 /var/www/nextcloud/lib/base.php(648): OC_App::loadApps()
#22 /var/www/nextcloud/lib/base.php(1094): OC::init()
#23 /var/www/nextcloud/console.php(49): require_once(’/var/www/nextcl…’)
#24 /var/www/nextcloud/occ(11): require_once(’/var/www/nextcl…’)

I really need some help! Thank you very much.

Hi @jujukeke

Try to uninstall the other php versions:

sudo apt remove php7.3* 
sudo apt remove php8.0*

…and make sure all needed PHP modules are installed for PHP 7.4, especially PHP7.4-apcu

sudo apt install php7.4-apcu

https://docs.nextcloud.com/server/latest/admin_manual/installation/source_installation.html

Also all config changes that have been made for another PHP version have to be made again for PHP7.4. Ideally you have notes how you installed and configured PHP, when you first installed your Nextcloud. Otherwise you can take a look here…

https://docs.nextcloud.com/server/latest/admin_manual/installation/source_installation.html#php-ini-configuration-notes

Thanks for these advices.
First, I uninstall the other php versions as suggested, and now:
>> php -v PHP 7.4.16 (cli) (built: Mar 5 2021 08:37:59) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies
AND
http:\my_url\info.php
# PHP Version 7.4.16 …

I do not understand how to identify missing PHP 7.4 modules (how to compare existing with required?), so I only install “php7.4-acpu”.

During my first installation, I remember to open php.ini file and made some changes inside it, so I performe the same:
sudo nano /etc/php/7.4/apache2/php.ini
memory_limit = 512M upload_max_filesize = 200M max_execution_time = 360 post_max_size = 200M date.timezone = Europe/Paris

I restart apache2 service, but still the same error on my nextcloud url
Internal Server Error …

You suggest me to take a look here:
https://docs.nextcloud.com/server/latest/admin_manual/installation/source_installation.html#php-ini-configuration-notes

In my php7.4 folder, I have 4 subfolders
>>/etc/php/7.4$ ls apache2 cli fpm mods-available
Do I need to edit php.ini in these subfolders ? I do not remember to modify MANUALLY any more php files during my first install :frowning:

The link I posted, lists the names of the required PHP modules. The exact names of the packages can differ from distribution to distribution.

You can get a list of all availiable (and installed) PHP packages in Debian/Ubuntu with:

apt list php7.4*

The * is used as a wildcard here.

Install at least all modules mentioned here… provided you use mysql or MariaDB as a database and Apache as a wevserver

https://docs.nextcloud.com/server/latest/admin_manual/installation/example_ubuntu.html?highlight=ubuntu#example-installation-on-ubuntu-20-04-lts

sudo apt install libapache2-mod-php7.4
sudo apt install php7.4-gd php7.4-mysql php7.4-curl php7.4-mbstring php7.4-intl
sudo apt install php7.4-gmp php7.4-bcmath php-imagick php7.4-xml php7.4-zip

GREAT!!! Thanks bb77 !

It works! :smiling_face_with_three_hearts: :star_struck: :+1:

So, I installed the recommanded php modules that you list above !
Just be careful, php-imagick is not correct (it will install the version 8.0), so I modified to php7.4-imagick. There is a mistake in the documentation.

1 Like