phpMyAdmin not working After Fresh install with apache2

Viewed 5966

when i try to access the phpmyadmin page i receive the following error:

<?php
declare(strict_types=1);
use PhpMyAdmin\Routing;
if (! defined('ROOT_PATH')) {
    // phpcs:disable PSR1.Files.SideEffects
    define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
    // phpcs:enable
}
global $route, $containerBuilder;
require_once ROOT_PATH . 'libraries/common.inc.php';
$dispatcher = Routing::getDispatcher();
Routing::callControllerForRoute($route, $dispatcher, $containerBuilder);

couldn't find a solution to this on any pixel of the internet, any help would be appreciated.

3 Answers

You can try to remove my php with apt-get --purge remove php-common and download it back with apt-get install php7.4 php7.4-mysqli php7.4-xml followed by systemctl reload apache2 to restart apache.

If the above does not work, I recommend you to re-download phpmyadmin

If you see php code in your browser it means that the PHP interpreter wasn't used. This means the problem is not with PhpMyAdmin but with your php installation. I googled quickly this but you (or others) may find better tutorials.

When new to apache php and mysql/mariadb I recommend installing wampserver or mamp. They do take all the hard configuration work from you.

I was facing the same problem but solved it through the below command

sudo apt install libapache2-mod-php8.1

sudo systemctl restart apache2
Related