SOLVED Php not loading anymore after apache reinstall (dumb mistake)

Hello guys, this is going to be a complicated one (or at least it seems like it for frustrated me).
Please see reddit post which sort of describes the steps I’ve tried: https://www.reddit.com/r/NextCloud/comments/i7tz6d/messed_up_apache2_reinstall/g14r0em/

Nextcloud was running absolutely perfect this morning, however after buying a new domain today I decided to reinstall Apache2 as I was getting lost in the SSL configs. I decided to simply move var/www/nextcloud to a different folder, uninstall apache2 and reinstall, then simply move it back, setup nextcloud.conf and woosh I’d be up and running again. Ha!

So the current problem is that PhP doesn’t seem to be loading at all on my nextcloud instance despite everything seeming to be normal. I’ve already made a reddit post and I got wonderful help but sadly no success.
First and foremost, here is what I get when I try going to my site:

* @author Joas Schilling * @author Jörn Friedrich Dreyer * @author Lukas Reschke * @author Morris Jobke * @author Robin Appelman * @author Roeland Jago Douma * @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, ['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, ['app' => 'index']); \OC::$server->getLogger()->logException($ex2, ['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, ['app' => 'index']); //show the user a detailed error page OC_Template::printExceptionErrorPage($ex, 500); } catch (Error $ex) { try { \OC::$server->getLogger()->logException($ex, ['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); } 

Not very useful now is it (love the developpers though <3). Now to business:

After this error, I naturally checked my Apache log… Nothing. I then made that reddit post as I had no idea what to do. It turns out this means that php isn’t being loaded at all. I’ve created a temporary php file supposed to give me the php version it is using but doing nextcloud/phpversion.php is just printing the code I used.

Here is my nextcloud.conf:

    Alias /nextcloud "/var/www/nextcloud/"
<Directory /var/www/nextcloud/>
        Options +FollowSymlinks
        AllowOverride All
        <IfModule mod_dav.c>
                Dav off
        </IfModule>
        SetEnv HOME /var/www/nextcloud
        SetEnv HTTP_HOME /var/www/nextcloud
</Directory>

Even though php was installed fine before reinstalling nextcloud, it doesn’t seem to be working anymore so I tried installing: php v4 (and alllllll the modules one by one), a2enmod php7.4 didn’t work for some reason so I scripted it manually by using the outdated 7.0 version that is for some reason installed (but that I know is not supported). It ‘worked’, the php says it loaded fine I even got this message in the apache2 log:

[`Tue Aug 11 23:10:03.069421 2020] [so:warn] [pid 122231] AH01574: module php7_module is already loaded, skipping`

I even tried the php-fms way by doing all these steps: https://www.interserver.net/tips/kb/change-php-version-apache- …no luck

For some strange reason Apache simply will not load Php, the site loads fine by going to the default apache, the annoying part is that I can’t even get it to give me an error. It all should work but it just isn’t.

I now tried with 7.2 by installing all the modules and only doing a2enmod php7.2, that ‘worked’ (as in it didn’t show any error), I reinstalled it but no. still nothing.

I’d love some help!
Thanks

If anyone comes across this post, please don’t be like me…
DOn’T DiSaBLe PHp ON YOuR BRoWSer aNd SpENd 6HOuRs tRyiNG to FiGURe Out WhAT the PRoBlem Was

1 Like