PHP Warning: PHP Startup: Unable to load dynamic library ‚/usr/lib/php/20151012/apcu.so‘ – /usr/lib/php/20151012/apcu.so: cannot open shared object file: No such file or directory in Unknown on line 0

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Hello all,

I searched the internet and the forum, but couldn´t come up with a solution. Any pointers are welcomed.

Nextcloud version: 13.0.2.1
Operating system and version: Ubuntu 18.04
Apache or nginx version : nginx/1.15.2
PHP version: PHP 7.2.7-0ubuntu0.18.04.2 (cli) (built: Jul 4 2018 16:55:24) ( NTS )

The issue you are facing:
I update my server from 16.04 to 18.04. When I tried to open nextcloud the following message appeared

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.

Is this the first time you’ve seen this error?: Y

The output of your Nextcloud log in Admin > Logging:

{"reqId":"CoakpCbPOe86tF72VUPn","level":3,"time":"2018-08-23T10:56:54+02:00","remoteAddr":"193.111.217.134","user":"--","app":"core","method":"GET","url":"\/nextcloud\/","message":"Exc
eption: {\"Exception\":\"OC\\\\HintException\",\"Message\":\"Memcache \\\\OC\\\\Memcache\\\\APCu not available for local cache\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/nextcloud\\
\/lib\\\/private\\\/Server.php(503): OC\\\\Memcache\\\\Factory->__construct('b4f3994d12ad87c...', Object(OC\\\\Log), '\\\\\\\\OC\\\\\\\\Memcache\\\\\\\\AP...', '\\\\\\\\OC\\\\\\\\Memca
che\\\\\\\\AP...', NULL)\\n#1 \\\/var\\\/www\\\/nextcloud\\\/3rdparty\\\/pimple\\\/pimple\\\/src\\\/Pimple\\\/Container.php(113): OC\\\\Server->OC\\\\{closure}(*** sensitive parameters
 replaced ***)\\n#2 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Utility\\\/SimpleContainer.php(116): Pimple\\\\Container->offsetGet('OC\\\\\\\\Memcache\\\\\\\\Fac.
..')\\n#3 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/ServerContainer.php(132): OC\\\\AppFramework\\\\Utility\\\\SimpleContainer->query('OC\\\\\\\\Memcache\\\\\\\\Fac...')\\n#4 \\
\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/Server.php(971): OC\\\\ServerContainer->query('OC\\\\\\\\Memcache\\\\\\\\Fac...')\\n#5 \\\/var\\\/www\\\/nextcloud\\\/3rdparty\\\/pimple\
\\/pimple\\\/src\\\/Pimple\\\/Container.php(113): OC\\\\Server->OC\\\\{closure}(*** sensitive parameters replaced ***)\\n#6 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/AppFramewor
k\\\/Utility\\\/SimpleContainer.php(116): Pimple\\\\Container->offsetGet('OC\\\\\\\\Template\\\\\\\\JSC...')\\n#7 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/ServerContainer.php(1
32): OC\\\\AppFramework\\\\Utility\\\\SimpleContainer->query('OC\\\\\\\\Template\\\\\\\\JSC...')\\n#8 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/TemplateLayout.php(304): OC\\\\Se
rverContainer->query('OC\\\\\\\\Template\\\\\\\\JSC...')\\n#9 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/TemplateLayout.php(146): OC\\\\TemplateLayout::findJavascriptFiles(Array)
\\n#10 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/legacy\\\/template.php(207): OC\\\\TemplateLayout->__construct('error', '')\\n#11 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\
\\/Template\\\/Base.php(132): OC_Template->fetchPage()\\n#12 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/legacy\\\/template.php(351): OC\\\\Template\\\\Base->printPage()\\n#13 \\\
/var\\\/www\\\/nextcloud\\\/index.php(55): OC_Template::printExceptionErrorPage(Object(OC\\\\HintException))\\n#14 {main}\",\"File\":\"\\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/
Memcache\\\/Factory.php\",\"Line\":97,\"Hint\":\"Is the matching PHP module installed and enabled?\"}","userAgent":"Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko\/20100101 Firefo
x\/52.0","version":"13.0.2.1"}                                                                                                                                                          

The output of your config.php file in /var/www/nextcloud/config/config.php:

<?php
$CONFIG = array (
  'instanceid' => 'ocpivgul4ci1',
  'passwordsalt' => 'HJklI1qoiQSVCln9a+6AU+iwBjiKVR',
  'secret' => 'fRH7QYPnWxHe/QEurkqsZrUAc3zmrTSoqzMW9DBCn/Qpsfj6',
  'trusted_domains' => 
  array (
    0 => 'DOMAIN',
    1 => '192.168.178.33',
  ),                                                                                                                                                                                    
  'datadirectory' => '/var/nextcloud_data',
  'overwrite.cli.url' => 'http://DOMAIN/nextcloud',
  'dbtype' => 'mysql',
  'version' => '13.0.2.1',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud_db_user',
  'dbpassword' => 'PvrPGsnn',
  'logtimezone' => 'Europe/Berlin',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'default_language' => 'de',
  'loglevel' => 0,
  'maintenance' => false,
  'theme' => '',
  'overwriteprotocol' => 'https',
  'skeletondirectory' => '',
);                                                                                                                                                                                      

The output of the log in /var/nextcloud_data/nextcloud.log:

{"reqId":"CoakpCbPOe86tF72VUPn","level":3,"time":"2018-08-23T10:56:54+02:00","remoteAddr":"193.111.217.134","user":"--","app":"core","method":"GET","url":"\/nextcloud\/","message":"Exc
eption: {\"Exception\":\"OC\\\\HintException\",\"Message\":\"Memcache \\\\OC\\\\Memcache\\\\APCu not available for local cache\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/nextcloud\\
\/lib\\\/private\\\/Server.php(503): OC\\\\Memcache\\\\Factory->__construct('b4f3994d12ad87c...', Object(OC\\\\Log), '\\\\\\\\OC\\\\\\\\Memcache\\\\\\\\AP...', '\\\\\\\\OC\\\\\\\\Memca
che\\\\\\\\AP...', NULL)\\n#1 \\\/var\\\/www\\\/nextcloud\\\/3rdparty\\\/pimple\\\/pimple\\\/src\\\/Pimple\\\/Container.php(113): OC\\\\Server->OC\\\\{closure}(*** sensitive parameters
 replaced ***)\\n#2 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Utility\\\/SimpleContainer.php(116): Pimple\\\\Container->offsetGet('OC\\\\\\\\Memcache\\\\\\\\Fac.
..')\\n#3 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/ServerContainer.php(132): OC\\\\AppFramework\\\\Utility\\\\SimpleContainer->query('OC\\\\\\\\Memcache\\\\\\\\Fac...')\\n#4 \\
\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/Server.php(971): OC\\\\ServerContainer->query('OC\\\\\\\\Memcache\\\\\\\\Fac...')\\n#5 \\\/var\\\/www\\\/nextcloud\\\/3rdparty\\\/pimple\
\\/pimple\\\/src\\\/Pimple\\\/Container.php(113): OC\\\\Server->OC\\\\{closure}(*** sensitive parameters replaced ***)\\n#6 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/AppFramewor
k\\\/Utility\\\/SimpleContainer.php(116): Pimple\\\\Container->offsetGet('OC\\\\\\\\Template\\\\\\\\JSC...')\\n#7 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/ServerContainer.php(1
32): OC\\\\AppFramework\\\\Utility\\\\SimpleContainer->query('OC\\\\\\\\Template\\\\\\\\JSC...')\\n#8 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/TemplateLayout.php(304): OC\\\\Se
rverContainer->query('OC\\\\\\\\Template\\\\\\\\JSC...')\\n#9 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/TemplateLayout.php(146): OC\\\\TemplateLayout::findJavascriptFiles(Array)
\\n#10 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/legacy\\\/template.php(207): OC\\\\TemplateLayout->__construct('error', '')\\n#11 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\
\\/Template\\\/Base.php(132): OC_Template->fetchPage()\\n#12 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/legacy\\\/template.php(351): OC\\\\Template\\\\Base->printPage()\\n#13 \\\
/var\\\/www\\\/nextcloud\\\/index.php(55): OC_Template::printExceptionErrorPage(Object(OC\\\\HintException))\\n#14 {main}\",\"File\":\"\\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/
Memcache\\\/Factory.php\",\"Line\":97,\"Hint\":\"Is the matching PHP module installed and enabled?\"}","userAgent":"Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko\/20100101 Firefo
x\/52.0","version":"13.0.2.1"}                                                                                                                                                          

The output of the log in /var/log/nginx/error.log:

2018/08/23 08:30:50 [error] 5045#5045: *1560 open() "/etc/nginx/html/a2billing/admin/Public/index.php" failed (2: No such file or directory), client: 37.49.231.158, server: laufsegel.g
oip.de, request: "GET //a2billing/admin/Public/index.php HTTP/1.1", host: "78.52.215.215:443"                                                                                           
2018/08/23 09:13:51 [error] 5045#5045: *1563 access forbidden by rule, client: 60.191.38.77, server: DOMAIN, request: "GET / HTTP/1.1", host: "78.52.215.215:443"            
2018/08/23 10:08:07 [warn] 1321#1321: the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/conf.d/DOMAIN.conf:28                      
2018/08/23 10:08:09 [error] 1516#1516: *2 open() "/etc/nginx/html/server-status" failed (2: No such file or directory), client: 127.0.0.1, server: DOMAIN, request: "GET /ser
ver-status?auto HTTP/1.1", host: "127.0.0.1"                                                                                                                                            
2018/08/23 10:08:09 [error] 1516#1516: *4 open() "/etc/nginx/html/server-status" failed (2: No such file or directory), client: 127.0.0.1, server: DOMAIN, request: "GET /ser
ver-status?auto HTTP/1.1", host: "127.0.0.1"                                                                                                                                            
2018/08/23 10:08:10 [error] 1516#1516: *6 open() "/etc/nginx/html/stub_status" failed (2: No such file or directory), client: 127.0.0.1, server: DOMAIN, request: "GET /stub_
status HTTP/1.1", host: "127.0.0.1"                                                                                                                                                     
2018/08/23 10:08:10 [error] 1516#1516: *8 open() "/etc/nginx/html/stub_status" failed (2: No such file or directory), client: 127.0.0.1, server: DOMAIN, request: "GET /stub_
status HTTP/1.1", host: "127.0.0.1"                                                                                                                                                     
2018/08/23 10:08:10 [error] 1516#1516: *10 open() "/etc/nginx/html/status" failed (2: No such file or directory), client: 127.0.0.1, server: DOMAIN, request: "GET /status HT
TP/1.1", host: "127.0.0.1"                                                                                                                                                              
2018/08/23 10:08:10 [error] 1516#1516: *12 open() "/etc/nginx/html/status" failed (2: No such file or directory), client: 127.0.0.1, server: DOMAIN, request: "GET /status HT
TP/1.1", host: "127.0.0.1"                                                                                                                                                              
2018/08/23 10:08:10 [error] 1516#1516: *14 open() "/etc/nginx/html/status" failed (2: No such file or directory), client: 127.0.0.1, server: DOMAIN, request: "GET /status?fu
ll&json HTTP/1.1", host: "127.0.0.1"                                                                                                                                                    
2018/08/23 10:08:10 [error] 1516#1516: *16 open() "/etc/nginx/html/status" failed (2: No such file or directory), client: 127.0.0.1, server: DOMAIN, request: "GET /status?fu
ll&json HTTP/1.1", host: "127.0.0.1"                                                                                                                                                    
2018/08/23 10:09:06 [error] 1516#1516: *29 open() "/etc/nginx/html/favicon.ico" failed (2: No such file or directory), client: 193.111.217.134, server: DOMAIN, request: "GET
 /favicon.ico HTTP/1.1", host: "DOMAIN"                                                                                                                                      

Also I get via cron the following message

PHP Warning: PHP Startup: Unable to load dynamic library ‚/usr/lib/php/20151012/apcu.so‘ – /usr/lib/php/20151012/apcu.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‚/usr/lib/php/20151012/apcu.so‘ – /usr/lib/php/20151012/apcu.so: cannot open shared object file: No such file or directory in Unknown on line 0

As found here I tried to comment out in /etc/php/7.2/fpm/conf.d/20-apcu.ini the line

extension=apcu.so 

and restarted the complete system. Same result.

Also I tried to reinstall php

php7.2-fpm php7.2-gd php7.2-mysql php7.2-curl php7.2-xml php7.2-zip php7.2-intl php7.2-mbstring php7.2-bz2 php7.2-json php-apcu

No result.

Any ideas?

Besr regards
Hans

If I get the error messages right, PHP tries to load an older APCu library than the one for PHP7.2. 20151012 is PHP7.0 while you actually want/reinstalled the 7.2 version, which is 20170718.

Are you sure that there is no older PHP version installed/active? Check php -v

As you configured APCu memory caching for Nextcloud, you must not comment out the line within the ini file, otherwise Nextcloud UI will show internal server errors.

Are you sure that there is no older PHP version installed/active? Check php -v

PHP 7.2.7-0ubuntu0.18.04.2 (cli) (built: Jul  4 2018 16:55:24) ( NTS )                                                                                                                  
Copyright (c) 1997-2018 The PHP Group                                                                                                                                                   
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies                                                                                                                           
    with Zend OPcache v7.2.7-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies  

In /usr/lib/php/20170718 is apcu.so, but not in /usr/lib/php/20151012. is a symlink helpful?

My /usr/lib/php/ looks like this

drwxr-xr-x 2 root root 4096 Aug 21 12:56 20151012
drwxr-xr-x 2 root root 4096 Aug 23 13:45 20170718
drwxr-xr-x 3 root root 4096 Mai 16 06:54 7.0
drwxr-xr-x 3 root root 4096 Aug 21 12:56 7.2
-rwxr-xr-x 1 root root  659 Mai 10 14:20 php7.0-fpm-checkconf
-rwxr-xr-x 1 root root  309 Mai 10 14:20 php7.0-fpm-reopenlogs
-rwxr-xr-x 1 root root  309 Jul  4 18:55 php7.2-fpm-reopenlogs
-rw-r--r-- 1 root root 4845 Jan 18  2018 php-helper                                                                                                                                     
-rw-r--r-- 1 root root 9534 Jan 18  2018 php-maintscript-helper                                                                                                                         
-rwxr-xr-x 1 root root 2922 Jan 18  2018 sessionclean

As you configured APCu memory caching for Nextcloud, you must not comment out the line within the ini file, otherwise Nextcloud UI will show internal server errors.

I undid the comment out, as that was no solution and I got an cURL error in Nextcloud UI.

So there are definitely PHP7.0 remains on your system and Nginx might be configured to use those (while cli php -v uses the new version).
Try the following to check if PHP7.0 packages are installed:
dpkg --get-selections | grep '^php7.0'

If there is an output, you can purge those. But first verify/make Nginx use PHP7.2. Within your nginx config (/etc/nginx/nginx.conf) or the vhosts there should be a php handler defined, pointing to a php7.X-fpm.sock. Of course this needs to be php7.2-fpm.sock.

You can also check the PHP version that the webserver uses via phpinfo() page:
sudo -u www-data echo '<?php phpinfo(); ?>' > /var/www/html/phpinfo.php
Then open this page.

If the above is done, you can purge the PHP7.0 remains:
apt purge $(dpkg --get-selections | grep '^php7.0')
When the command asks to confirm, check that there are really just php7.0 packages removed/purged and no other for whatever reason dependents that you may need.

If there is an output, you can purge those. But first verify/make Nginx use PHP7.2. Within your nginx config (/etc/nginx/nginx.conf) or the vhosts there should be a php handler defined, pointing to a php7.X-fpm.sock . Of course this needs to be php7.2-fpm.sock .

That was the solution. I don´t know, why it wasn´t updated, but now it works. Thanks.

Yeah since php7.2 has an own set of packages, besides rare exceptions like php-apcu and php-redis, the old ones stay. This is actually great as it allows you to install multiple php versions, e.g. if a certain web service does not yet support the most current one.
But then one needs to take care to configure the servers/vhosts accordingly.

Great that It works now.

just linking to other related issue