Fresh nextcloud install failed

Having issues with your DietPi installation, or, found a bug? Post it here.
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Fresh nextcloud install failed

Post by MichaIng »

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

Code: Select all

#!/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:

Code: Select all

dpkg -l | grep -E '(php|apache)'
ls -l /etc/apache2/mods-available/php*
User avatar
snoodler
Posts: 24
Joined: Sun Dec 01, 2019 1:30 pm

Re: Fresh nextcloud install failed

Post by snoodler »

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:~#
User avatar
snoodler
Posts: 24
Joined: Sun Dec 01, 2019 1:30 pm

Re: Fresh nextcloud install failed

Post by snoodler »

should i try and re install?
User avatar
snoodler
Posts: 24
Joined: Sun Dec 01, 2019 1:30 pm

Re: Fresh nextcloud install failed

Post by snoodler »

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/ad ... ation.html
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Georg Ehrke <oc.list@georgehrke.com>
* @author Joas Schilling <coding@schilljs.com>
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
* @author Lukas Reschke <lukas@statuscode.ch>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Robin Appelman <robin@icewind.nl>
* @author Sergio Bertolín <sbertolin@solidgear.es>
* @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Vincent Petry <pvince81@owncloud.com>
*
* @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 <http://www.gnu.org/licenses/>
*
*/

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);
}
User avatar
Joulinar
Posts: 2068
Joined: Sat Nov 16, 2019 12:49 am

Re: Fresh nextcloud install failed

Post by Joulinar »

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 8)
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
snoodler
Posts: 24
Joined: Sun Dec 01, 2019 1:30 pm

Re: Fresh nextcloud install failed

Post by snoodler »

this is what i have installed:

https://imgur.com/a/hFjKihE

what should i re install?
User avatar
Joulinar
Posts: 2068
Joined: Sat Nov 16, 2019 12:49 am

Re: Fresh nextcloud install failed

Post by Joulinar »

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.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Fresh nextcloud install failed

Post by MichaIng »

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.
User avatar
snoodler
Posts: 24
Joined: Sun Dec 01, 2019 1:30 pm

Re: Fresh nextcloud install failed

Post by snoodler »

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:~#
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Fresh nextcloud install failed

Post by MichaIng »

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