Fresh nextcloud install failed

Was having some owner permissions with nextcloud so I decided to re install it with dietpi-software but now it is broken:

this is the error when i try to go to 192.168.2.4/nextcloud

  • @author Joas Schilling * @author Jörn Friedrich Dreyer * @author Lukas Reschke * @author Morris Jobke * @author Robin Appelman * @author Sergio Bertolín * @author Thomas Müller * @author Vincent Petry * * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see * */ require_once DIR . ‘/lib/versioncheck.php’; try { require_once DIR . ‘/lib/base.php’; OC::handleRequest(); } catch(\OC\ServiceUnavailableException $ex) { \OC::$server->getLogger()->logException($ex, array(‘app’ => ‘index’)); //show the user a detailed error page OC_Template::printExceptionErrorPage($ex, 503); } catch (\OC\HintException $ex) { try { OC_Template::printErrorPage($ex->getMessage(), $ex->getHint(), 503); } catch (Exception $ex2) { try { \OC::$server->getLogger()->logException($ex, array(‘app’ => ‘index’)); \OC::$server->getLogger()->logException($ex2, array(‘app’ => ‘index’)); } catch (Throwable $e) { // no way to log it properly - but to avoid a white page of death we try harder and ignore this one here } //show the user a detailed error page OC_Template::printExceptionErrorPage($ex, 500); } } catch (\OC\User\LoginException $ex) { OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage(), 403); } catch (Exception $ex) { \OC::$server->getLogger()->logException($ex, array(‘app’ => ‘index’)); //show the user a detailed error page OC_Template::printExceptionErrorPage($ex, 500); } catch (Error $ex) { try { \OC::$server->getLogger()->logException($ex, array(‘app’ => ‘index’)); } catch (Error $e) { http_response_code(500); header(‘Content-Type: text/plain; charset=utf-8’); print(“Internal Server Error\n\n”); print(“The server encountered an internal error and was unable to complete your request.\n”); print(“Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n”); print(“More details can be found in the webserver log.\n”); throw $ex; } OC_Template::printExceptionErrorPage($ex, 500); }

snoodler
Many thanks for your report.

This is not an error you see but the raw PHP file which is not parsed obviously. Hence the PHP handler is down. You use Lighttpd as webserver, I guess?

Please run the following and paste output:

journalctl -u php7.3-fpm
systemctl restart php7.3-fpm
cat /var/log/php7.3-fpm.log*

root@DietPi:~# journalctl -u php7.3-fpm
– Logs begin at Wed 2020-01-22 14:28:15 GMT, end at Wed 2020-01-22 18:28:29 GMT. –
Jan 22 14:28:40 DietPi systemd[1]: Starting The PHP 7.3 FastCGI Process Manager…
Jan 22 14:28:41 DietPi systemd[1]: Started The PHP 7.3 FastCGI Process Manager.
root@DietPi:~# systemctl restart php7.3-fpm
root@DietPi:~# cat /var/log/php7.3-fpm.log*
[22-Jan-2020 18:29:20] NOTICE: Terminating …
[22-Jan-2020 18:29:20] NOTICE: exiting, bye-bye!
[22-Jan-2020 18:29:20] NOTICE: fpm is running, pid 25893
[22-Jan-2020 18:29:20] NOTICE: ready to handle connections
[22-Jan-2020 18:29:20] NOTICE: systemd monitor interval set to 10000ms

Interesting, PHP seems to run as expected. To verify again:

systemctl status php7.3-fpm

In this case probably Lighttpd is not correctly configured to use php7.3-fpm, please paste the output of:

cat /etc/lighttpd/conf-available/15-fastcgi-php.conf

this is what i have for webservers:

https://imgur.com/a/qnyg2wQ

root@DietPi:~# cat /etc/lighttpd/conf-available/15-fastcgi-php.conf
cat: /etc/lighttpd/conf-available/15-fastcgi-php.conf: No such file or directory
root@DietPi:~#

snoodler
Ah okay, Apache2. Did you install+configure php7.3-fpm manually? Since on default install Apache2 uses its default internal PHP handler (mod-php), hence php7.3-fpm is not required.

So you could clean up things and assure the Apache2 PHP module being active:

apt install libapache2-mod-php7.3
apt purge php7.3-fpm
a2enmod mpm_prefork php7.3
systemctl restart apache2

Did not get fixed.

I did install apache with dietpi-software

here is what I did:

root@DietPi:~# sudo apt install libapache2-mod-php7.3
Reading package lists… Done
Building dependency tree
Reading state information… Done
libapache2-mod-php7.3 is already the newest version (7.3.11-1~deb10u1).
0 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.
root@DietPi:~# sudo apt purge php7.3-fpm
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
php7.3-fpm*
0 upgraded, 0 newly installed, 1 to remove and 13 not upgraded.
After this operation, 3,458 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database … 86014 files and directories currently installed.)
Removing php7.3-fpm (7.3.11-1~deb10u1) …
apache2_invoke php7.3-fpm prerm: No action required
(Reading database … 85999 files and directories currently installed.)
Purging configuration files for php7.3-fpm (7.3.11-1~deb10u1) …
apache2_invoke php7.3-fpm postrm: No action required
dpkg: warning: while removing php7.3-fpm, directory ‘/etc/php/7.3/fpm/conf.d’ not empty so not removed
Processing triggers for systemd (241-7~deb10u2+rpi1) …
root@DietPi:~# sudo a2enmod mpm_prefork php7.3
Considering conflict mpm_event for mpm_prefork:
ERROR: Module mpm_event is enabled - cannot proceed due to conflicts. It needs to be disabled first!
Considering conflict mpm_worker for mpm_prefork:
ERROR: Module php7.3 does not exist!
root@DietPi:~# systemctl restart apache2
root@DietPi:~#

Googled “Considering conflict mpm_worker for mpm_prefork:”

Found this:
https://stackoverflow.com/questions/46258053/change-apache-mpm-from-prefork-to-worker
https://serverfault.com/questions/682272/cant-enable-mpm-prefork-with-apache-2-4-on-ubuntu-14-04

It seems it needs one module or another to be enabled or disabled…the links show you how to do that

This shows to install the PHP 7.3 there are other things that need to be installed
https://askubuntu.com/questions/1148129/how-do-i-enable-php-7-3-in-apache2

It seems like there has been an attempt to enable mpm_event with php-fpm.

Do the following:

a2dismod mpm_event
# If it prints an error that other modules depend on mpm_event, disable them the same way first
a2enmod mpm_prefork
a2enmod php7.3
# If it still shows php7.3 module missing, try to reinstall the module
apt install --reinstall libapache2-mod-php7.3
a2enmod php7.3
systemctl restart apache2

got an error back while installing:

root@DietPi:~# a2dismod mpm_event
Module mpm_event disabled.
To activate the new configuration, you need to run:
systemctl restart apache2
root@DietPi:~# a2enmod mpm_prefork
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Enabling module mpm_prefork.
To activate the new configuration, you need to run:
systemctl restart apache2
root@DietPi:~# a2enmod php7.3
ERROR: Module php7.3 does not exist!
root@DietPi:~# apt install --reinstall libapache2-mod-php7.3
Reading package lists… Done
Building dependency tree
Reading state information… Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 13 not upgraded.
Need to get 1,082 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://ftp.agdsn.de/pub/mirrors/raspbian/raspbian buster/main armhf libapache2-mod-php7.3 armhf 7.3.11-1~deb10u1 [1,082 kB]
Fetched 1,082 kB in 13s (81.1 kB/s)
(Reading database … 85991 files and directories currently installed.)
Preparing to unpack …/libapache2-mod-php7.3_7.3.11-1~deb10u1_armhf.deb …
Unpacking libapache2-mod-php7.3 (7.3.11-1~deb10u1) over (7.3.11-1~deb10u1) …
Setting up libapache2-mod-php7.3 (7.3.11-1~deb10u1) …
dpkg: error processing package libapache2-mod-php7.3 (–configure):
installed libapache2-mod-php7.3 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
libapache2-mod-php7.3
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@DietPi:~# a2enmod php7.3
ERROR: Module php7.3 does not exist!
root@DietPi:~#

What the hack… This module is fixed part of the package and must be available: https://packages.debian.org/buster/amd64/libapache2-mod-php7.3/filelist
I checked the postinst script:

#!/bin/sh

set -e

if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
    . /usr/share/apache2/apache2-maintscript-helper

    php_enable() {
	local a2query_ret=0
	a2query -m "php7.3" > /dev/null 2>&1 || a2query_ret=$?
	if [ "$a2query_ret" -eq 0 ] ; then
	    apache2_msg "info" "$DPKG_MAINTSCRIPT_PACKAGE: not switching MPM - already enabled"
	    return 1
	elif [ "$a2query_ret" -eq 32	 ] ; then
	    apache2_msg "info" "$DPKG_MAINTSCRIPT_PACKAGE: not switching MPM - disabled by maintainer"
	    return 1
	fi

	PHP_MODULE=$(a2query -m | sed -n 's/^\(php[\.0-9]*\) (enabled.*)/\1/p')
        if [ -n "$PHP_MODULE" -a "$PHP_MODULE" != "php7.3" ]; then
	    apache2_msg "err" "$DPKG_MAINTSCRIPT_PACKAGE: $PHP_MODULE module already enabled, not enabling PHP 7.3"
	    return 1
	fi

	mpm=$(a2query -M)
	case "$(a2query -M)" in
	    prefork|itk) return 0;;
	    *) if apache2_switch_mpm prefork; then return 0; fi;;
	esac
        apache2_msg "err" "$DPKG_MAINTSCRIPT_PACKAGE: Could not switch to prefork MPM, not enabling PHP 7.3"
	return 1
    }

else
    echo "Warning: Could not load Apache 2.4 maintainer script helper."

    php_enable() {
        return 1;
    }

fi

# we've registered a trigger to handle extension updates.
if [ "$1" = "triggered" ] && [ "$2" = "/etc/php/7.3/apache2/conf.d" ]; then
    if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
	. /usr/share/apache2/apache2-maintscript-helper
	apache2_reload restart
    fi
    exit 0
elif [ "$1" != "configure" ]; then
    exit 0
fi

CONFDIR=/etc/php/7.3/apache2/conf.d

if [ "$1" = "configure" ]; then
    phpini="/etc/php/7.3/apache2/php.ini"

    if [ "apache2" = "cli" ]; then
	ucf /usr/lib/php/7.3/php.ini-production.apache2 $phpini
    else
	ucf /usr/lib/php/7.3/php.ini-production $phpini
    fi
    ucfr libapache2-mod-php7.3 $phpini

    if [ -e /usr/lib/php/php-maintscript-helper ]; then
	. /usr/lib/php/php-maintscript-helper
	
	mods=$(phpquery -M -v 7.3)
	for mod in $mods; do
	    php_invoke enmod 7.3 apache2 $mod
	done
    fi

    if [ -n "$2" ] && dpkg --compare-versions "$2" lt "7.0.3-2~"; then
	rm -f /etc/php/7.3/apache2/conf.d/20-opcache.ini;
    fi	    
fi

# Automatically added by dh_apache2/UNDECLARED
if php_enable; then
	if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
		. /usr/share/apache2/apache2-maintscript-helper
		for conf in php7.3  ; do
			apache2_invoke enmod $conf  || exit 1
		done
	fi
fi
# End automatically added section


exit 0

Only chance it fails can be just for the same reason, php7.3 module not being available.

Lets debug from start. Could you paste:

dpkg -l | grep -E '(php|apache)'
ls -l /etc/apache2/mods-available/php*

root@DietPi:~# dpkg -l | grep -E ‘(php|apache)’
ii apache2 2.4.38-3+deb10u3 armhf Apache HTTP Server
ii apache2-bin 2.4.38-3+deb10u3 armhf Apache HTTP Server (modules and other binary files)
ii apache2-data 2.4.38-3+deb10u3 all Apache HTTP Server (common files)
ii apache2-utils 2.4.38-3+deb10u3 armhf Apache HTTP Server (utility programs for web servers)
iF libapache2-mod-php7.3 7.3.11-1~deb10u1 armhf server-side, HTML-embedded scripting language (Apache 2 module)
ii php-apcu 5.1.17+4.0.11-1 armhf APC User Cache for PHP
ii php-common 2:69 all Common files for PHP packages
ii php-igbinary 3.0.0-1 armhf igbinary PHP serializer
ii php-mysql 2:7.3+69 all MySQL module for PHP [default]
ii php-redis 4.2.0-1 armhf PHP extension for interfacing with Redis
ii php-smbclient 0.9.0-3+b1 armhf PHP wrapper for libsmbclient
ii php7.3-cli 7.3.11-1~deb10u1 armhf command-line interpreter for the PHP scripting language
ii php7.3-common 7.3.11-1~deb10u1 armhf documentation, examples and common module for PHP
ii php7.3-curl 7.3.11-1~deb10u1 armhf CURL module for PHP
ii php7.3-gd 7.3.11-1~deb10u1 armhf GD module for PHP
ii php7.3-intl 7.3.11-1~deb10u1 armhf Internationalisation module for PHP
ii php7.3-json 7.3.11-1~deb10u1 armhf JSON module for PHP
ii php7.3-mbstring 7.3.11-1~deb10u1 armhf MBSTRING module for PHP
ii php7.3-mysql 7.3.11-1~deb10u1 armhf MySQL module for PHP
ii php7.3-opcache 7.3.11-1~deb10u1 armhf Zend OpCache module for PHP
ii php7.3-readline 7.3.11-1~deb10u1 armhf readline module for PHP
ii php7.3-sqlite3 7.3.11-1~deb10u1 armhf SQLite3 module for PHP
ii php7.3-xml 7.3.11-1~deb10u1 armhf DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii php7.3-zip 7.3.11-1~deb10u1 armhf Zip module for PHP
ii python3-certbot-apache 0.31.0-1 all Apache plugin for Certbot
root@DietPi:~# ls -l /etc/apache2/mods-available/php*
ls: cannot access ‘/etc/apache2/mods-available/php*’: No such file or directory
root@DietPi:~#

should i try and re install?

this is what it shows at 192.168.2.4/nextcloud

\

<?php /** * * Your webserver seems to be not configured to use PHP or PHP is not installed. * Please contact your administrator or follow our documentation: * https://docs.nextcloud.com/server/15/admin_manual/installation/source_installation.html * * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Georg Ehrke <> * @author Joas Schilling <> * @author Jörn Friedrich Dreyer <> * @author Lukas Reschke <> * @author Morris Jobke <> * @author Robin Appelman <> * @author Sergio Bertolín <> * @author Thomas Müller <> * @author Vincent Petry <> * * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see * */ require_once __DIR__ . '/lib/versioncheck.php'; try { require_once __DIR__ . '/lib/base.php'; OC::handleRequest(); } catch(\OC\ServiceUnavailableException $ex) { \OC::$server->getLogger()->logException($ex, array('app' => 'index')); //show the user a detailed error page OC_Template::printExceptionErrorPage($ex, 503); } catch (\OC\HintException $ex) { try { OC_Template::printErrorPage($ex->getMessage(), $ex->getHint(), 503); } catch (Exception $ex2) { try { \OC::$server->getLogger()->logException($ex, array('app' => 'index')); \OC::$server->getLogger()->logException($ex2, array('app' => 'index')); } catch (Throwable $e) { // no way to log it properly - but to avoid a white page of death we try harder and ignore this one here } //show the user a detailed error page OC_Template::printExceptionErrorPage($ex, 500); } } catch (\OC\User\LoginException $ex) { OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage(), 403); } catch (Exception $ex) { \OC::$server->getLogger()->logException($ex, array('app' => 'index')); //show the user a detailed error page OC_Template::printExceptionErrorPage($ex, 500); } catch (Error $ex) { try { \OC::$server->getLogger()->logException($ex, array('app' => 'index')); } catch (Error $e) { http_response_code(500); header('Content-Type: text/plain; charset=utf-8'); print("Internal Server Error\n\n"); print("The server encountered an internal error and was unable to complete your request.\n"); print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n"); print("More details can be found in the webserver log.\n"); throw $ex; } OC_Template::printExceptionErrorPage($ex, 500); }

Yep,

you still missing the php support on your WebServer. Therefore the page is displaying the real code instead of the website.

It might be easier to start from scratch if you not mind. Means remove all web server, php, database as well as NectCloud components and install NetCloud freshly from dietpi-software. This should pull the required components automatically and configure it the right way.

But I’m not sure if you have other software packaged running that require one of the components like web server or database. And removing them could cause other issues. So it’s up to you :sunglasses:

this is what i have installed:

https://imgur.com/a/hFjKihE

what should i re install?

Puhh quite a lot of software installed on your device. I see as well Certbot/SSL. So might not be the best idea to remove thinks like web-server as this could break your SSL config. Hmm maybe MichaIng has some more ideas how to get PHP back working.

You can also try to reinstall Apache2 first: apt install --reinstall apache2-data apache2 libapache2-mod-php7.3
I have no idea how this can happen, but contained files/dirs are still missing in your case. The following dir must exist:
/etc/apache2/mods-available/ (part of Apache2 package)
and ist must contain a php7.3.conf file (part of libapache2-mod-php7.3)
Then a2enmod php7.3 must succeed, to have Apache2 handle PHP files correctly.

If this still is not the case, then there must be something wrong deeper in your system, e.g. file corruption, broken apt or dpkg or such. Probably dmesg then shows some related file system errors or such.

root@DietPi:~# apt install --reinstall apache2-data apache2 libapache2-mod-php7.3
Reading package lists… Done
Building dependency tree
Reading state information… Done
0 upgraded, 0 newly installed, 3 reinstalled, 0 to remove and 29 not upgraded.
1 not fully installed or removed.
Need to get 416 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://ftp.agdsn.de/pub/mirrors/raspbian/raspbian buster/main armhf apache2 armhf 2.4.38-3+deb10u3 [251 kB]
Get:2 http://ftp.agdsn.de/pub/mirrors/raspbian/raspbian buster/main armhf apache2-data all 2.4.38-3+deb10u3 [165 kB]
Fetched 416 kB in 1s (804 kB/s)
E: Internal Error, No file name for libapache2-mod-php7.3:armhf
root@DietPi:~#

Strange, a package is there: http://ftp.agdsn.de/pub/mirrors/raspbian/raspbian/pool/main/p/php7.3/
I have to check the mirror list. Meanwhile you could simply retry or change the APT mirror :thinking:.