'Why Does Phpmyadmin Suddenly Not Load

Just upgraded to Ubuntu 22.04 and now my phpadmin won't load. I get this following error

Parse error: syntax error, unexpected 'static' (T_STATIC) in /usr/share/php/Symfony/Component/DependencyInjection/ContainerBuilder.php on line 272

I opened up the file, and here is the specific code in that segment.

public function addResource(ResourceInterface $resource): static
{
    if (!$this->trackResources) {
        return $this;
    }

   if ($resource instanceof GlobResource && $this->inVendors($resource->getPrefix())) {
       return $this;
    }

    $this->resources[(string) $resource] = $resource;

   return $this;
}

Yesterday before the upgrade, everything was working fine. Does anybody have any suggestions?



Solution 1:[1]

Since version 8.0, PHP allows static as a return type for class methods. Apparently your PHP version was downgraded.

Solution 2:[2]

You have to check your phpmyadmin version Coz in php 8.* version phpmyadmin 5.* version will be required.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Grzegorz Pietrzak
Solution 2 Aakash Singha