phpmyadmin支持php7,php 7-带有phpmyadmin的PHP 7给出了很多弃用声明

在Ubuntu 16.04 LTS上安装了PHP7和phpmyadmin后,用户收到多个弃用警告。问题涉及到php-gettext和streams.php文件中的构造函数。解决方案包括重新安装phpmyadmin及其依赖,修改相关文件的构造函数,或者在php.ini中调整error_reporting设置以忽略弃用警告。此外,还可以考虑更新服务器、使用不同PPA或仅重启Apache服务。
摘要由CSDN通过智能技术生成

php 7-带有phpmyadmin的PHP 7给出了很多弃用声明

我安装了运行PHP7和phpmyadmin的Ubuntu 16.04 LTS。但是,我收到了很多弃用通知,例如:

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

Methods with the same name as their class will not be constructors in a future version of PHP; StringReader has a deprecated constructor

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)

这有问题吗? 如何消除这些通知(每次加载页面或执行操作时弹出这些通知)?

18个解决方案

106 votes

我遇到了这个问题,并通过简单地重新安装phpmyadmin及其依赖项来解决了这个问题。 运行以下命令:

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

重新安装后,您应该像新人一样好!

David Curry answered 2019-11-03T09:19:32Z

64 votes

我解决此问题的方法是通过在16.my下使用phpmyadmin中的折旧通知错误处的askubuntu说明。 它涉及在/usr/share/php/php-gettext/streams.php中更改三行,在/usr/share/php/php-gettext/gettext.php中更改一行。

通过该链接,这是您需要做的更改(如果您有ubuntu 16.04):

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

第48行StringReader错误。

转到第52行并更改

function StringReader ($str='') {

function __construct($str='') {

84行FileReader错误

转到第90行并更改

function FileReader($filename) {

function __construct($filename) {

第145行CacheFileReader错误

转到第146行并进行更改

function CachedFileReader($filename) {

function __construct($filename) {

使用sudo nano /usr/share/php/php-gettext/gettext.php.

第36行gettext_reader {错误

我认为您现在掌握了要点,转到101行并进行更改

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

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

user123943 answered 2019-11-03T09:21:21Z

40 votes

您可以为phpmyadmin使用另一个PPA。这里是PPA链接

sudo add-apt-repository ppa:nijel/phpmyadmin

sudo apt update

sudo apt install phpmyadmin

由于它只是一个临时解决方案,也不是最佳解决方案,因此需要重建ubuntu存储库中的phpmyadmin软件包。

Deepanshu Jain answered 2019-11-03T09:21:52Z

24 votes

您应该尝试在php.ini中设置error_reporting =〜E_DEPRECATED,这将删除弃用错误。 它应该类似于error_reporting = ~E_DEPRECATED & E_ALL。请让我知道它是否有效。

beniaminp answered 2019-11-03T09:22:16Z

16 votes

亲爱的@BeniaminPantiru,您的回答是正确的,但您的解决方案无法解决问题,因为您告诉Apache不要显示过时错误,而不是要修复错误。 但是我们可以通过升级必要的安全更新和程序包轻松修复此错误。 键入以下命令即可解决问题。

sudo apt-get dist-upgrade

Mohamed Haseem answered 2019-11-03T09:22:44Z

5 votes

您没有提到正在使用哪个版本的phpMyAdmin或从哪个版本安装了phpMyAdmin,但它似乎是Ubuntu打包的版本4.5.4.1,或者是源代码中相当旧且不受支持的版本。 无论哪种方式,我都相信您的问题已在[https://github.com/phpmyadmin/phpmyadmin/issues/11462]中报告(并修复)-如果您使用的是Ubuntu打包版本,则其中的注释表明nijel PPA版本应该更适合您。

当然,Beniamin Pantiru接受的答案也很好,并且,如果您正在运行生产服务器,则应减少PHP显示的警告和错误的数量,这是标准的最佳做法。

Isaac Bennetch answered 2019-11-03T09:23:20Z

3 votes

我已通过将错误报告设置为php.ini文件路径/etc/php/7.0中的以下内容进行修复

error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR

共同价值观:

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

Ranjithkumar MV answered 2019-11-03T09:23:55Z

3 votes

我有同样的问题。 我只是想提一下,在清除phpmyadmin并重新安装它之前。 尝试重新启动Apache。 就我而言,这是最简单的方法,因此我首先尝试了它。 我只是希望人们节省时间。

sudo service apache2 restart

Mycodingproject answered 2019-11-03T09:24:20Z

2 votes

使用sudo apt-get dist-upgrade更新服务器对我有用,然后重新启动apache。

我认为此问题是由于没有足够频繁地更新phpmyadmin引起的。

Trey Tyler answered 2019-11-03T09:24:52Z

2 votes

在依赖关系本身(在您的情况下为php-gettext)中解决该问题之前,您不想更改全局PHP设置,以便不影响其他内容,您可能希望尝试通过以下方式自定义PHPMyadmin的index.php:

error_reporting( ~E_DEPRECATED & E_ALL );

在开始的某个地方或通过使用

php_value error_reporting 24575

在.htdocs或虚拟主机配置指令中。 我认为后一种选择更好。

Wojciech Fornal answered 2019-11-03T09:25:30Z

2 votes

该问题是由过时的PHP类构造函数语法引起的。 要解决此问题,请在终端上运行以下代码:

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

John Collins answered 2019-11-03T09:25:55Z

0 votes

我以不同的方式解决了这个问题,因为我从较新的Ubuntu下载了官方软件包:

https://packages.ubuntu.com/search?keywords=phpmyadmin

然后安装它:

sudo dpkg -i phpmyadmin_4.6.6-5_all.deb

因此,不必使用非官方的存储库,该软件包将在以后进行更新。

eitch answered 2019-11-03T09:26:33Z

0 votes

phpMyAdmin登录页面上的“弃用通知”消息

好的,通过编辑php.ini文件可以轻松解决此问题:

文件路径:/etc/php/7.0/apache2/php.ini

将error_reporting值更改为:

CODE: SELECT ALL

error_reporting = ~E_DEPRECATED & E_ALL.

默认情况下,它处于注释位置,因此请取消注释并更改它。

然后重新启动Apache:

# systemctl restart apache2

或第二种解决方案

apt-get purge phpmyadmin

apt-get安装phpmyadmin

如果需要然后安装

apt-get安装php7.0-mbstring

然后重新启动Apache:

# systemctl restart apache2

好了,“不再使用通知”消息不再显示。

Shrikant Verma answered 2019-11-03T09:28:17Z

0 votes

当以前运行的原始PHP版本与当前的PHP服务器版本不匹配时,就会出现问题。 根据您安装的PHP版本,这应该足够了。

sudo apt-get update

sudo apt-get install phpmyadmin php7.0-gettext php7.0-mbstring -y

Chibueze Opata answered 2019-11-03T09:28:42Z

0 votes

我不想弄乱php的安装,因此,我只是重新启动了Apache,它对我来说非常理想。

"sudo service apache2 restart"

PrafulPravin answered 2019-11-03T09:29:09Z

-1 votes

最佳答案还有一件事; 需要添加

Include /etc/phpmyadmin/apache.conf

/etc/apache2/apache2.conf

并重新启动Apache:

/etc/init.d/apache2 restart

Michael Soltys answered 2019-11-03T09:29:42Z

-3 votes

最后我永久解决了这个问题。

在服务器中找到您的php.ini文件。 它应该在/etc/php/7.0/apache2文件夹中

用nano打开

nano /etc/php/7.0/apache2/php.ini

在php.ini文件中找到(ctrl + w)upload_max_filesize = 2M(默认值)

根据需要将默认值更改为50M或100M或20M。

保存并重新启动apache2服务

service apache2 restart

请告诉我您的满意:-)

Ali TEK - etulia.com answered 2019-11-03T09:30:47Z

-5 votes

重新启动服务器帮助了我

shutdown -r now

Moode Osman answered 2019-11-03T09:31:11Z

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值