RogerCO
RogerCO

Reputation: 141

Phpmyadmin not working after upgrade to 22.04 and cannot be uninstalled

Upgraded from Ubuntu 20.04 to 22.04 and upgraded php from 7.4 to 8.1. Phpmyadmin on localhost apache2 was working fine before (v5.0.3 from Oct 2020) but now I get a load of errors on the login page. eg:

Deprecation Notice in ./vendor/twig/twig/src/Loader/FilesystemLoader.php#40
 realpath(): Passing null to parameter #1 ($path) of type string is deprecated

which looks like its barfing at php8.1, and then if I try to login I get a page saying "The page not working right now"

When I run sudo apt-get remove phpmyadmin it reports "Package phpmyadmin is not installed, so not removed" which is unhelpful as it is still installed and exists in /usr/share/phpmyadmin and the apache2 config file is enabled.

So how does one remove it - will simply deleting the /usr/share/phpmyadmin folder and disabling the phpmyadmin.conf in apache2 to work, or will it leave other stuff behind in the mysql (mariabd) database that will mess up a re-install with the latest version?

Or can I simply install the latest version over the top of the existing 5.0.3?

And as a secondary question what has gone wrong here? - it seems that apt has forgotten it has phpmyadmin installed during the 20.04->22.04 update.

Upvotes: 0

Views: 5538

Answers (2)

Bello Afeez
Bello Afeez

Reputation: 1

Try this

If you're using linux

Empty the ContainerBuilder.php file

echo "" > /usr/share/php/Symfony/Component/DependencyInjection/ContainerBuilder.php

Open the ContainerBuilder.php file

nano /usr/share/php/Symfony/Component/DependencyInjection/ContainerBuilder.php

Then paste this content below in the file.

https://pastebin.com/Q5tSiaMR

Upvotes: 0

RogerCO
RogerCO

Reputation: 141

Ok so it turns out it is indeed that the old version of phpMyAdmin doesn't work with php8 :-(

First switch back to php7.4

sudo a2dismod php8.1
sudo a2enmod php7.4
sudo systemctl restart apache2

Now phpmyadmin5.0.2 works again Then you can remove the old version and install the new one. First download it from the phpmyadmin website and extract it - say to ~/Downloads/phpMyAdmin-5.2.0-english/

sudo rm -rf /usr/share/phpmyadmin/
sudo mkdir /usr/share/phpmyadmin/
sudo mv ~/Downloads/phpMyAdmin-5.2.0-english/* /usr/share/phpmyadmin/
sudo chown -R root:root /usr/share/phpmyadmin

You'll probably have to also create a file /usr/share/phpmyadmin/config.in.phpcontaining a 'secret' passphrase 32 chars long eg:

<?php
// use here a value of your choice 32 chars long or just copy this if you are on your own localhost
$cfg['blowfish_secret'] = '12345678901234567890123456789012';
$i=0;
$i++;
$cfg['Servers'][$i]['auth_type']     = 'cookie';

and you may also need to create a temp dir sudo mkdir /usr/share/phpmyadmin/tmp && sudo chmod 777 /usr/share/phpmyadmin/tmp

and finally switch back to php8

sudo a2dismod php7.4
sudo a2enmod php8.1
sudo systemctl restart apache2

Upvotes: 0

Related Questions