0

I have installed multiple version of PHP 5.6, 7.2, 7.3, 7.4 and 8.0 with 7.4 set as the default. I tried to switch to different version for some projects running on older version, doing this:

sudo update-alternatives --set php /usr/bin/php5.6

Then restart the apache by doing:

sudo service apache2 restart

And also did if switching to other version

sudo update-alternatives --config php

Then restarted Apache

But when I open to http://localhost/phpmyadmin again which was working recently, now its throwing error 500 then did check the error on /var/log/apache2/error.log and it says:

PHP message: PHP Warning: Unsupported declare 'strict_types' in /usr/share/php/PhpMyAdmin/MoTranslator/Loader.php on line 23\nPHP message: PHP Parse error: syntax error, unexpected '?' in /usr/share/php/PhpMyAdmin/MoTranslator/Loader.php on line 116\n`

And created a file with phpinfo it it and printed the PHP version, it says php 5.6 but in CLI, by doing php -v it says php 7.4, below is the screenshot of the phpinfo()

enter image description here

Any help, ideas, are greatly appreciated.

1 Answer 1

-2

Just enable PHP 7.1 + for /usr/share/phpmyadmin by making .htaccess file in that folder with content like:

<FilesMatch \.php> 
    # Apache 2.4.10+ can proxy to unix socket 
    SetHandler "proxy:unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost/" 
</FilesMatch> 

or change PHP version from /etc/phpmyadmin/apache.conf

You can also try updating phpmyadmin to latest version (4.9.7 is latest version supporting PHP 5.5+ currently, and Ubuntu 4.9.5 installs older version by default currently)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .