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?

3
  • On this tutorial it says that you have to enable mcrypt and mbstring php modules and restart apache. Did you do that?
    – bistoco
    Jul 7, 2016 at 21:39
  • yes I updated mcrypt and mbstring and have restarted apache.
    – tseward
    Jul 13, 2016 at 15:30
  • I will recommend [download the package directly ](phpmyadmin.net/downloads) that fits your php/mysql versions, to troubleshot.
    – bistoco
    Jul 18, 2016 at 15:38

4 Answers 4

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) {
2
  • 2
    one should see : sudo nano /usr/share/php/php-gettext/gettext.php and sudo nano /usr/share/php/php-gettext/streams.php Oct 11, 2016 at 13:10
  • the packaged files are from 20101225. So even though keeping backups is just what you do - always - you should be safe from a package update unfixing your fix, any updates should contain that fix by themselves!
    – flowtron
    Jan 15, 2018 at 10:09
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
1
  • saved me a bit of time there... thanks man :-)
    – Adam
    May 23, 2018 at 10:14
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.

2
  • 1
    This helped me though May 2, 2018 at 11:57
  • Be careful, this ppa hasn't received any update for more than a year.
    – Laurent
    Jun 14, 2018 at 4:32
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

You must log in to answer this question.

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