Internal server error going from PHP 7.0 to PHP 7.2

Dear all, that seems to be a common issue but I was not yet able to find a solution.

Currently im on Nextcloud 13.0.5 with Ubuntu 16.04.5, Apache2 and PHP7.0

First I tried a Ubuntu upgrade to 18.04, workd fine but broke my nextcloud due to php so I fall back on my snapshot I did before and updated to PHP 7.2 using this manual:
https://ayesh.me/Ubuntu-PHP-7.2

This is what im coming from

root@nextcloud:/home/ncadmin# dpkg -l | grep php | tee packages.txt
ii dh-php 0.10 all debhelper add-on to handle PHP PECL extensions
ii libapache2-mod-php7.0 7.0.30-0ubuntu0.16.04.1 amd64 server-side, HTML-embedded scripting language (Apache 2 module)
ii php-common 1:35ubuntu6.1 all Common files for PHP packages
ii php-pear 1:1.10.1+submodules+notgz-6 all PEAR Base System
ii php-smbclient 0.8.0~rc1-2build1 amd64 PHP wrapper for libsmbclient
ii php7.0-cli 7.0.30-0ubuntu0.16.04.1 amd64 command-line interpreter for the PHP scripting language
ii php7.0-common 7.0.30-0ubuntu0.16.04.1 amd64 documentation, examples and common module for PHP
ii php7.0-curl 7.0.30-0ubuntu0.16.04.1 amd64 CURL module for PHP
ii php7.0-dev 7.0.30-0ubuntu0.16.04.1 amd64 Files for PHP7.0 module development
ii php7.0-gd 7.0.30-0ubuntu0.16.04.1 amd64 GD module for PHP
ii php7.0-imap 7.0.30-0ubuntu0.16.04.1 amd64 IMAP module for PHP
ii php7.0-intl 7.0.30-0ubuntu0.16.04.1 amd64 Internationalisation module for PHP
ii php7.0-json 7.0.30-0ubuntu0.16.04.1 amd64 JSON module for PHP
ii php7.0-ldap 7.0.30-0ubuntu0.16.04.1 amd64 LDAP module for PHP
ii php7.0-mbstring 7.0.30-0ubuntu0.16.04.1 amd64 MBSTRING module for PHP
ii php7.0-mcrypt 7.0.30-0ubuntu0.16.04.1 amd64 libmcrypt module for PHP
ii php7.0-mysql 7.0.30-0ubuntu0.16.04.1 amd64 MySQL module for PHP
ii php7.0-opcache 7.0.30-0ubuntu0.16.04.1 amd64 Zend OpCache module for PHP
ii php7.0-pgsql 7.0.30-0ubuntu0.16.04.1 amd64 PostgreSQL module for PHP
ii php7.0-readline 7.0.30-0ubuntu0.16.04.1 amd64 readline module for PHP
ii php7.0-sqlite3 7.0.30-0ubuntu0.16.04.1 amd64 SQLite3 module for PHP
ii php7.0-xml 7.0.30-0ubuntu0.16.04.1 amd64 DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii php7.0-zip 7.0.30-0ubuntu0.16.04.1 amd64 Zip module for PHP
ii pkg-php-tools 1.32ubuntu2 all various packaging tools and scripts for PHP packages

I can replace all of these with 7.2 (except php7.0-mcrypt , an issue?) and once I activate PHP 7.2 by

a2enconf php7.2

I got this message trying to access my nextcloud server:

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.

Any ideas what to do?

Thanks a lot!

My complete nextcloud config dan be found here
https://pastebin.com/8LgNGgjx

nextcloud has nothing to do with a error 500 following two major os updates.

Seek help from the ondrej/php community as i guess it is totally related to php 7.2

as soon as the 500 error is fixed, the nextcloud community will be here …

as a clue, do a backup of your www root directory, and create a very simple html file as a landing page. This will help you to see if your apache2 conf is still working.

When done, create a simple php.info file in order to debug your php conf files.

phpinfo.php
<?php

// Show all information, defaults to INFO_ALL
phpinfo();

?>

seems to work both fine

https://abload.de/image.php?img=2018-08-1114_58_59-dmirf87.pnghttps://abload.de/image.php?img=2018-08-1114_58_59-dmirf87.png
https://abload.de/image.php?img=2018-08-1114_59_11-dmjffzb.png

7.0 as well as 7.2. But not with my nextcloud thing. Might be related to an PHP 7.2.8 bug

https://bugs.php.net/bug.php?id=76651 ?

The bug you describe is between php and mysql.

If, during your OS update, your mysql was updated to 8.0.4 refer to:

in your pic

the ini file are /etc/php/7.0 they should ne 7.2 nop ??!!!

ARGH, did nt see you second pics …

let me think for a minutes, i come back.

sry I attached 2 pics, one shows 7.2.8 to work fine with that apacke2 config , the other the original 7.0 running fine as well.

So in general, php is working in both versions here.

I felt back to my snapshot and ubuntu 16.04, so no OS update in place so far. I just added php 7.2 and no I have both and can switch between them with

root@nextcloud:/var/www/nextcloud# a2dismod php7.0
Module php7.0 disabled.
To activate the new configuration, you need to run:
_ service apache2 restart_
root@nextcloud:/var/www/nextcloud# service apache2 restart
root@nextcla2enmod php7.2
Considering dependency mpm_prefork for php7.2:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.2:
Enabling module php7.2.
To activate the new configuration, you need to run:
_ service apache2 restart_
root@nextcloud:/var/www/nextcloud# service apache2 restart
root@nextcloud:/var/www/nextcloud#

With that test php file this works fine for me, but not with my nextcloud folder.

did you

a2enmod php7.2

take time to check:

this answer was cross-timed with your previous message , sorry

np =) thansk for the fast help anyway. If I can provide any further config details please let me know.

Current State:
root@nextcloud:/var/www/nextcloud# dpkg -l | grep php | tee
ii dh-php 0.10 all debhelper add-on to handle PHP PECL extensions
ii libapache2-mod-php7.0 7.0.30-0ubuntu0.16.04.1 amd64 server-side, HTML-embedded scripting language (Apache 2 module)
ii libapache2-mod-php7.2 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (Apache 2 module)
ii php 1:7.2+62+ubuntu16.04.1+deb.sury.org+1 all server-side, HTML-embedded scripting language (default)
ii php-apcu 5.1.11+4.0.11-1+ubuntu16.04.1+deb.sury.org+1 amd64 APC User Cache for PHP
ii php-apcu-bc 1.0.4-1+ubuntu16.04.1+deb.sury.org+1 amd64 APCu Backwards Compatibility Module
ii php-common 1:35ubuntu6.1 all Common files for PHP packages
ii php-imagick 3.4.3-3+ubuntu16.04.1+deb.sury.org+1 amd64 Provides a wrapper to the ImageMagick library
ii php-pear 1:1.10.1+submodules+notgz-6 all PEAR Base System
ii php-smbclient 0.9.0-1+ubuntu16.04.1+deb.sury.org+2 amd64 PHP wrapper for libsmbclient
ii php7.0-cli 7.0.30-0ubuntu0.16.04.1 amd64 command-line interpreter for the PHP scripting language
ii php7.0-common 7.0.30-0ubuntu0.16.04.1 amd64 documentation, examples and common module for PHP
ii php7.0-curl 7.0.30-0ubuntu0.16.04.1 amd64 CURL module for PHP
ii php7.0-dev 7.0.30-0ubuntu0.16.04.1 amd64 Files for PHP7.0 module development
ii php7.0-gd 7.0.30-0ubuntu0.16.04.1 amd64 GD module for PHP
ii php7.0-imap 7.0.30-0ubuntu0.16.04.1 amd64 IMAP module for PHP
ii php7.0-intl 7.0.30-0ubuntu0.16.04.1 amd64 Internationalisation module for PHP
ii php7.0-json 7.0.30-0ubuntu0.16.04.1 amd64 JSON module for PHP
ii php7.0-ldap 7.0.30-0ubuntu0.16.04.1 amd64 LDAP module for PHP
ii php7.0-mbstring 7.0.30-0ubuntu0.16.04.1 amd64 MBSTRING module for PHP
ii php7.0-mcrypt 7.0.30-0ubuntu0.16.04.1 amd64 libmcrypt module for PHP
ii php7.0-mysql 7.0.30-0ubuntu0.16.04.1 amd64 MySQL module for PHP
ii php7.0-opcache 7.0.30-0ubuntu0.16.04.1 amd64 Zend OpCache module for PHP
ii php7.0-pgsql 7.0.30-0ubuntu0.16.04.1 amd64 PostgreSQL module for PHP
ii php7.0-readline 7.0.30-0ubuntu0.16.04.1 amd64 readline module for PHP
ii php7.0-sqlite3 7.0.30-0ubuntu0.16.04.1 amd64 SQLite3 module for PHP
ii php7.0-xml 7.0.30-0ubuntu0.16.04.1 amd64 DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii php7.0-zip 7.0.30-0ubuntu0.16.04.1 amd64 Zip module for PHP
ii php7.2 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 all server-side, HTML-embedded scripting language (metapackage)
ii php7.2-bz2 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 bzip2 module for PHP
ii php7.2-cli 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 command-line interpreter for the PHP scripting language
ii php7.2-common 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 documentation, examples and common module for PHP
ii php7.2-curl 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 CURL module for PHP
ii php7.2-fpm 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php7.2-gd 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 GD module for PHP
ii php7.2-intl 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 Internationalisation module for PHP
ii php7.2-json 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 JSON module for PHP
ii php7.2-ldap 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 LDAP module for PHP
ii php7.2-mbstring 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 MBSTRING module for PHP
ii php7.2-mysql 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 MySQL module for PHP
ii php7.2-opcache 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 Zend OpCache module for PHP
ii php7.2-readline 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 readline module for PHP
ii php7.2-xml 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii php7.2-zip 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 amd64 Zip module for PHP
ii pkg-php-tools 1.32ubuntu2 all various packaging tools and scripts for PHP packages

use the php72
tag in the search field… there is some message around

I saw that already but I was not able to determine the exact solution from that thread.

Somethimes the solution seems to be simply

a2dismod php7.0
a2enmod php7.2

but that I did, the issue has to be somewhere else. phpinwo works fine, ill swicth back to my original nextcloud folder.

Edit:

Can I debug any further why I get a “Internal Server Error” using my netxloud data root instead of that php info test thing i did before? That opcache thing should not be causing this i guess, my 7.2 php ini wasnt touched so far.

no idea? Could it be a PHP Bug`?

Seems to be the same here

Had the same issue, was able to load nextcloud with php7.0, and it broke when switching to 7.1 and 7.2; it was an opcache issue.

I suggest you remove the lines relating to Redis and memcache from your config:

    "memcache.local": "\\OC\\Memcache\\Redis",
    "memcache.distributed": "\\OC\\Memcache\\Redis",
    "memcache.locking": "\\OC\\Memcache\\Redis",

And follow the APCu path adding:

‘memcache.local’ => ‘\OC\Memcache\APCu’,

to the config.php

1 Like

I don’t know if this will help or turn out to be a complete red herring, but I figured I’d pitch it in in case it helps.

I backed up my Nextcloud installation that was running on Ubuntu 16.04. I then reimaged the machine as Ubuntu 18.04 with PHP 7.2 and restored Nextcloud. I then got Internal server error 500.

As I was getting nowhere with it I put aside my backup and installed Nextcloud from scratch. It worked fine aside from the fact that I could not install the SAML authentication App because the PHP encryption module (mcrypt) was missing as the module is deprecated in php 7.2. Once I resolved this issue I was able to install the SAML authentication App and all worked fine. I opted to reseed my data rather than attempt to restore Nextcloud again so I cannot be sure that this would have fixed the “Internal server error 500”, but I very much suspect that this was the case. I therefore suggest that you disable any Apps dependant on php module mcrypt and see if the error goes away.

thanks a lot! That was solving my php 7.2 issue as well. Ill try tp go to 18.04.1 now. Thanks again!