Internal Server Error - Broken PHP

Nextcloud version (eg, 12.0.2): 13.0.5
Operating system and version (eg, Ubuntu 17.04): NextCloudPi v0.58.2
Apache or nginx version (eg, Apache 2.4.25): Apache 2 (Unknown specific version)
PHP version (eg, 7.1): 7.0

The issue you are facing:

I run NextCloudPi on a RPi 3 B+.
I made the (dumb) decision to try and upgrade to PHP 7.2, and doing so purged the default install of PHP 7.0. Since I couldn’t install PHP 7.2, I decided to reinstall PHP 7.0, but after doing this, my server is completely inaccessible.
Before this, it was fine. I also noticed in the report that it marks PHP as ‘down’.
I assume I broke / missed a library? How do I get it back up? Thanks in advance!

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Purge ‘php7.0’ and ‘php7.0-common’ with apt
  2. Try to install php7.2 >>>> ‘Package not found’, can’t easily install/ complie source since access to Pi is cli only
  3. Attempt to reinstall php7.0 with apt
  4. Restart system
  5. Website has internal server error > Completely no access from any IP or nextcloud clients.

Output of ‘sudo ncp-report’:

NextCloudPi diagnostics

NextCloudPi version  v0.58.1
NextCloudPi image    NextCloudPi_06-27-18
distribution         Raspbian GNU/Linux 9 \n \l
automount            yes
USB devices          sda
datadir              /var/www/nextcloud/data
data in SD           yes
data filesystem      ext2/ext3
data disk usage      2.0G/30G
rootfs usage         2.0G/30G
swapfile             /var/swap
dbdir                /var/lib/mysql
Nextcloud check      ok
Nextcloud version    13.0.5.2
HTTPD service        up
PHP service          down
MariaDB service      up
Redis service        up
Postfix service      up
internet check       ok
port check 80        open
port check 443       open
IP                   192.168.1.42
gateway              192.168.1.1
interface            wlan0
certificates         camdenrichter.com
NAT loopback         yes
uptime               11min

Nextcloud configuration

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": {
            "0": "localhost",
            "1": "192.168.1.42",
            "5": "nextcloudpi.local"
        },
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "http:\/\/localhost",
        "dbtype": "mysql",
        "version": "13.0.5.2",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "mail_smtpmode": "php",
        "mail_smtpauthtype": "LOGIN",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "overwriteprotocol": "https"
    }
}

HTTPd logs

[Sun Aug 12 00:38:29.015029 2018] [core:notice] [pid 552] AH00094: Command line: '/usr/sbin/apache2'
[Sun Aug 12 00:43:03.776924 2018] [core:notice] [pid 552] AH00052: child pid 816 exit signal Segmentatio
n fault (11)
[Sun Aug 12 00:43:03.777313 2018] [mpm_prefork:notice] [pid 552] AH00169: caught SIGTERM, shutting down
[Sun Aug 12 00:43:04.016452 2018] [ssl:warn] [pid 2299] AH01909: localhost:4443:0 server certificate doe
s NOT include an ID which matches the server name
[Sun Aug 12 00:43:05.125111 2018] [ssl:warn] [pid 2300] AH01909: localhost:4443:0 server certificate doe
s NOT include an ID which matches the server name
[Sun Aug 12 00:43:05.125904 2018] [http2:warn] [pid 2300] AH10034: The mpm module (prefork.c) is not sup
ported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands
 in this regard and the currently selected mpm will just not do. This is an advisory warning. Your serve
r will continue to work, but the HTTP/2 protocol will be inactive.
[Sun Aug 12 00:43:06.023639 2018] [mpm_prefork:notice] [pid 2300] AH00163: Apache/2.4.25 (Raspbian) Open
SSL/1.0.2l configured -- resuming normal operations
[Sun Aug 12 00:43:06.023905 2018] [core:notice] [pid 2300] AH00094: Command line: '/usr/sbin/apache2'
[Sun Aug 12 00:45:11.386077 2018] [mpm_prefork:notice] [pid 2300] AH00169: caught SIGTERM, shutting down
[Sun Aug 12 00:45:11.646287 2018] [ssl:warn] [pid 2450] AH01909: localhost:4443:0 server certificate doe
s NOT include an ID which matches the server name
[Sun Aug 12 00:45:12.122512 2018] [ssl:warn] [pid 2451] AH01909: localhost:4443:0 server certificate doe
s NOT include an ID which matches the server name
[Sun Aug 12 00:45:12.123198 2018] [http2:warn] [pid 2451] AH10034: The mpm module (prefork.c) is not sup
ported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands
 in this regard and the currently selected mpm will just not do. This is an advisory warning. Your serve
r will continue to work, but the HTTP/2 protocol will be inactive.
[Sun Aug 12 00:45:13.024798 2018] [mpm_prefork:notice] [pid 2451] AH00163: Apache/2.4.25 (Raspbian) Open
SSL/1.0.2l configured -- resuming normal operations
[Sun Aug 12 00:45:13.025053 2018] [core:notice] [pid 2451] AH00094: Command line: '/usr/sbin/apache2'
[Sun Aug 12 01:11:54.844373 2018] [mpm_prefork:notice] [pid 2451] AH00169: caught SIGTERM, shutting down
[Sun Aug 12 01:12:03.557558 2018] [ssl:warn] [pid 503] AH01909: localhost:4443:0 server certificate does
 NOT include an ID which matches the server name
[Sun Aug 12 01:12:04.108414 2018] [ssl:warn] [pid 720] AH01909: localhost:4443:0 server certificate does
 NOT include an ID which matches the server name
[Sun Aug 12 01:12:04.109230 2018] [http2:warn] [pid 720] AH10034: The mpm module (prefork.c) is not supp
orted by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands
in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server
 will continue to work, but the HTTP/2 protocol will be inactive.
[Sun Aug 12 01:12:05.014124 2018] [mpm_prefork:notice] [pid 720] AH00163: Apache/2.4.25 (Raspbian) OpenS
SL/1.0.2l configured -- resuming normal operations
[Sun Aug 12 01:12:05.014326 2018] [core:notice] [pid 720] AH00094: Command line: '/usr/sbin/apache2'

Database logs

2018-08-12  1:11:56 1639236416 [Note] /usr/sbin/mysqld: Shutdown complete

2018-08-12  1:12:24 1988722688 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2018-08-12  1:12:24 1988722688 [Note] InnoDB: The InnoDB memory heap is disabled
2018-08-12  1:12:24 1988722688 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-08-12  1:12:24 1988722688 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory bar
rier
2018-08-12  1:12:24 1988722688 [Note] InnoDB: Compressed tables use zlib 1.2.8
2018-08-12  1:12:24 1988722688 [Note] InnoDB: Using Linux native AIO
2018-08-12  1:12:24 1988722688 [Note] InnoDB: Using generic crc32 instructions
2018-08-12  1:12:24 1988722688 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-08-12  1:12:24 1988722688 [Note] InnoDB: Completed initialization of buffer pool
2018-08-12  1:12:24 1988722688 [Note] InnoDB: Highest supported file format is Barracuda.
2018-08-12  1:12:25 1988722688 [Note] InnoDB: 128 rollback segment(s) are active.
2018-08-12  1:12:25 1988722688 [Note] InnoDB: Waiting for purge to start
2018-08-12  1:12:25 1988722688 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.35-80.0 start
ed; log sequence number 121958613
2018-08-12  1:12:25 1447031616 [Note] InnoDB: Dumping buffer pool(s) not yet started
2018-08-12  1:12:25 1988722688 [Note] Plugin 'FEEDBACK' is disabled.
2018-08-12  1:12:25 1988722688 [Note] Server socket created on IP: '127.0.0.1'.
2018-08-12  1:12:25 1988722688 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.1.23-MariaDB-9+deb9u1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Raspbian 9.0

(Rest removed due to character limit)

seems like i have the same issue. Php info file works in 7.0 as well as 7.2. NC 13.0.5 only works with 7.0. I can switch inbetween by enabling 7.0 or 7.2 in apache2.

When you did:

you probably deleted some configuration files, like php.ini. How did you set up Nextcloud in the first place?

By using the default installation / setup. I don’t remember super clearly at this point. Again, I’m using nextcloudpi, which has special packaging for use on a Raspberry Pi, so I’m fairly sure I used it out-of-the-box or with whatever installer it had. If I did delete some config files like you said, how would I go about replacing them? Also, shouldn’t they have generated again once I reinstalled php?