12

I am getting errors when I launch phpmyadmin in 16.04:

Deprecation Notice in ./../php/php-gettext/streams.php#48

Backtrace

./../php/php-gettext/gettext.inc#41: require()
./libraries/select_lang.lib.php#477: require_once(./../php/php-gettext/gettext.inc)
./libraries/common.inc.php#569: require(./libraries/select_lang.lib.php)
./index.php#12: require_once(./libraries/common.inc.php)

It continues with these as well with the same backtrace as above:

Deprecation Notice in ./../php/php-gettext/streams.php#84
Deprecation Notice in ./../php/php-gettext/streams.php#145
Deprecation Notice in ./../php/php-gettext/gettext.php#36

I have updated and verified that I am on the latest gettext and mbstring. Any thoughts on resolving?

Zanna
  • 72,312
tseward
  • 133

4 Answers4

29

This depends whether you are adventurous enough. If you understand the error, it means your PHP has some old class constructors.

OLD Php Class Constructor

Class myclassname {

    function myclassname() {
      //This is a constructor
    }

New Php Class Constructor

Class myclassname {
    function __construct() {
      //this is the new constructor using __construct instead of the same function name as class name.
}

So what I did was to go into /usr/share/php/php-gettext/stream.php and /usr/share/php/php-gettext/gettext.php (or whatever file stated in your error), go to the file and change function myclassname() to function __construct.

The function myclassname should be identical to the CLASS myclassname declaration.

You should see about 4 errors if you are on ubuntu 16.04 with latest gettext. I just change that and it's not harmful to your system. It's a outdated programming syntax and if you upgrade in the future you wouldn't face any problem too. I will say it's a safe edit.

It's not really a major change or anything, just syntax updating. If you install from apt-get package you really have no other choice unless you compile yourself.

sudo nano /usr/share/php/php-gettext/streams.php

Line 48 StringReader Error.

Go to Line 52 and change

function StringReader ($str='') {

TO

function __construct($str='') {

Line 84 FileReader Error

Go to Line 90 and change

function FileReader($filename) {

to

function __construct($filename) {

Line 145 CacheFileReader error

Go to Line 146 and change

function CachedFileReader($filename) {

to

function __construct($filename) {

Using sudo nano /usr/share/php/php-gettext/gettext.php.

Line 36 gettext_reader { error

I think you get the gist now, go to line 101 and change

function gettext_reader($Reader, $enable_cache = true) {

To

function __construct($Reader, $enable_cache = true) {
muru
  • 207,228
8

Since I don't have enough reputation yet to comment on Someone Special's great answer, I'll just reply instead.

Here are the one-line commands that perform the suggested edits:

sed -ri.bak 's:function StringReader.*:function __construct($str=\x27\x27) {:' /usr/share/php/php-gettext/streams.php
sed -ri 's:function FileReader.*:function __construct($filename) {:' /usr/share/php/php-gettext/streams.php
sed -ri 's:function CachedFileReader.*:function __construct($filename) {:' /usr/share/php/php-gettext/streams.php
sed -ri.bak 's:function gettext_reader.*:function __construct($Reader, $enable_cache = true) {:' /usr/share/php/php-gettext/gettext.php
5

You can use another PPA for phpmyadmin.Here it is PPA Link

sudo add-apt-repository ppa:nijel/phpmyadmin
sudo apt update
sudo apt install phpmyadmin

As it is only a temporary solution or not a optimal one, till the package of phpmyadmin in ubuntu repos are rebuild.

0

This deprecation notice" message on login page of phpMyAdmin issue is easily solved by editing the php.ini file at /etc/php/7.0/apache2/php.ini

Change error_reporting value to:

error_reporting = ~E_DEPRECATED & E_ALL     

By default it is on comment position, so uncomment it and change it.

Then restart Apache:

sudo systemctl restart apache2
karel
  • 122,292
  • 133
  • 301
  • 332