Cant turn on apache2 with php7.1

i updated php version from apt update accidentaly and then service went down
i removed php7.4 which got installed and installed php7.1 again now i a2enmod php7.1 and checked for evey other php version to be uninstalled
now after i a2enmod php7.1 it says
root@berbidvps:~# a2dismod php7.1
Module php7.1 disabled.
To activate the new configuration, you need to run:
systemctl restart apache2
root@berbidvps:~# systemctl restart apache2
root@berbidvps:~# a2enmod php7.1
Considering dependency mpm_prefork for php7.1:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.1:
Enabling module php7.1.
To activate the new configuration, you need to run:
systemctl restart apache2
after systemctl restart apache2 i get
Job for apache2.service failed because the control process exited with error code.
See “systemctl status apache2.service” and “journalctl -xe” for details.
after systemctl status apache2 i get
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Thu 2020-03-12 09:38:02 EDT; 28s ago
Process: 1878 ExecStop=/usr/sbin/apachectl stop (code=exited, status=1/FAILURE)
Process: 1991 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Main PID: 1752 (code=exited, status=0/SUCCESS)

Mar 12 09:38:02 berbidvps systemd[1]: Starting The Apache HTTP Server…
Mar 12 09:38:02 berbidvps apachectl[1991]: apache2: Syntax error on line 146 of /etc/apache2/apache2.conf: Syntax error on line 3 of /etc/apache2/mods-enable
Mar 12 09:38:02 berbidvps apachectl[1991]: Action ‘start’ failed.
Mar 12 09:38:02 berbidvps apachectl[1991]: The Apache error log may have more information.
Mar 12 09:38:02 berbidvps systemd[1]: apache2.service: Control process exited, code=exited status=1
Mar 12 09:38:02 berbidvps systemd[1]: apache2.service: Failed with result ‘exit-code’.
Mar 12 09:38:02 berbidvps systemd[1]: Failed to start The Apache HTTP Server.
~
when i load my server ip/owncloud i get

<?php /** * @author Jörn Friedrich Dreyer * @author Lukas Reschke * @author Morris Jobke * @author Philipp Schaffrath * @author RealRancor * @author Robin Appelman * @author Sergio Bertolín * @author Thomas Müller * @author Vincent Petry * * @copyright Copyright (c) 2018, ownCloud GmbH * @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 * */ // Show warning if a PHP version below 7.0.7 is used, this has to happen here // because base.php will already use 7.0 syntax. if (\version_compare(PHP_VERSION, '7.0.7') === -1) { echo 'This version of ownCloud requires at least PHP 7.0.7
'; echo 'You are currently running PHP ' . PHP_VERSION . '. Please update your PHP version.'; return; } // Show warning if PHP 7.3 is used as ownCloud is not compatible with PHP 7.3 if (\version_compare(PHP_VERSION, '7.3.0alpha1') !== -1) { echo 'This version of ownCloud is not compatible with PHP 7.3
'; echo 'You are currently running PHP ' . PHP_VERSION . '.'; return; } // running oC on Windows is unsupported since 8.1, this has to happen here because // is seems that the autoloader on Windows fails later and just throws an exception. if (\strtoupper(\substr(PHP_OS, 0, 3)) === 'WIN') { echo 'ownCloud Server does not support Microsoft Windows.'; return; } 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_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); OC_Template::printExceptionErrorPage($ex); } catch (\OC\HintException $ex) { OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); OC_Template::printErrorPage($ex->getMessage(), $ex->getHint()); } catch (\OC\User\LoginException $ex) { OC_Response::setStatus(OC_Response::STATUS_FORBIDDEN); OC_Template::printErrorPage($ex->getMessage()); } catch (\OCP\Files\ForbiddenException $ex) { OC_Response::setStatus(OC_Response::STATUS_FORBIDDEN); OC_Template::printErrorPage($ex->getMessage()); } catch (Exception $ex) { try { \OC::$server->getLogger()->logException($ex, ['app' => 'index']); //show the user a detailed error page OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); OC_Template::printExceptionErrorPage($ex); } catch (\Exception $ex2) { // with some env issues, it can happen that the logger couldn't log properly, // so print out the exception directly echo(''); echo('Exception occurred while logging exception: ' . $ex->getMessage() . '
'); echo(\str_replace("\n", '
', $ex->getTraceAsString())); echo(''); } } catch (Error $ex) { \OC::$server->getLogger()->logException($ex, ['app' => 'index']); OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); OC_Template::printExceptionErrorPage($ex); } is there anything im missing?

If I read this correctly, you can restart your apache when you disable PHP 7.1. When you enable PHP 7.1 you can’t

So I would assume that you have two PHP versions enabled at the same time, check your mods-enabled folder.

1 Like

so i tried and searched for different versions included in apache2.conf and mods-enabled but found nothing so i thought that if u delete apache and directories and install again it might get fixed
so i did and deleted apache and /etc/apache2 and installed it again now when i try to a2enmod dev env etc and then a2enmod mpm_prefork all those commands get module not existed
so i made everything worse i guess
any suggestions?