skip to Main Content

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?

6

Answers


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

    Login or Signup to reply.
  2. You have to check your phpmyadmin version Coz in php 8.* version phpmyadmin 5.* version will be required.

    Login or Signup to reply.
  3. Yes, it’s a pain if you are running a PHP version prior to 8, such as 7.*.
    Download 5.2 here and install it.

    https://www.phpmyadmin.net/downloads/

    Completely purge your previous version and secure the directory where you install it (depends on your web server). That Symfony component ruined everything (line 272).

    Login or Signup to reply.
  4. Im using php7.4.30 and my fix was upgrading phpmyadmin.

    Here is a simple guide:

    https://devanswers.co/manually-upgrade-phpmyadmin/

    Login or Signup to reply.
    • upgrade php to 8.x
    • switch php version in apache:
    cd /etc/apache2/mods-enabled/
    sudo rm php7.4.conf
    sudo rm php7.4.load
    sudo ln -s ../mods-available/php8.0.load php8.0.load
    sudo ln -s ../mods-available/php8.0.conf php8.0.conf
    

    at the end, restart apache:

    sudo /etc/init.d/apache2 restart
    
    Login or Signup to reply.
  5. If you are using opcache preloading, you might be suffering from conflicts between phpMyAdmin’s Symfony namespaces and those of your own app. My workaround for this is to run phpMyAdmin on a different version of PHP

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search