PHP 7 with phpmyadmin gives lots of Deprecation Notices

前端 未结 20 1280
失恋的感觉
失恋的感觉 2020-12-12 13:16

I have Ubuntu 16.04 LTS running with PHP7 and phpmyadmin installed. However, I get a lot of deprecation notices like:

Depre         


        
相关标签:
20条回答
  • 2020-12-12 13:38

    The problem is caused by outdated PHP Class Constructor syntax. To fix this issue run the following code on your terminal:

    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
    
    0 讨论(0)
  • 2020-12-12 13:38

    I do not want to mess with the php installations, therefore I just restarted my Apache and it worked perfectly for me.

    "sudo service apache2 restart"
    
    0 讨论(0)
  • 2020-12-12 13:40

    The way I fixed this problem was by following the askubuntu instructions at depreciation notice error in phpmyadmin with 16.04. It involves changing three lines in /usr/share/php/php-gettext/streams.php and one line in /usr/share/php/php-gettext/gettext.php.

    From that link, this are the changes you need to do (if you have ubuntu 16.04):

    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) {
    
    0 讨论(0)
  • 2020-12-12 13:42

    I had fixed by setting error reporting to the following in php.ini file path /etc/php/7.0

    error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
    

    Common Values:

     E_ALL (Show all errors, warnings and notices including coding standards.)
    
     E_ALL & ~E_NOTICE  (Show all errors, except for notices)
    
     E_ALL & ~E_NOTICE & ~E_STRICT  (Show all errors, except for notices and coding standards warnings.)
    
     E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR  (Show only errors)
    
     Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
    
    0 讨论(0)
  • 2020-12-12 13:43

    restarting the server helped me

    shutdown -r now
    
    0 讨论(0)
  • 2020-12-12 13:44

    I had this problem and solved it with a simple reinstall of phpmyadmin and its dependencies. Run the following commands:

    sudo apt-get remove --purge phpmyadmin php-gettext php-mbstring -y
    sudo apt-get autoremove -y
    sudo apt-get update
    sudo apt-get install phpmyadmin php-gettext php-mbstring -y
    

    Once reinstalled, you should be good as new!

    0 讨论(0)
提交回复
热议问题