php 调用未定义的函数 __() 错误 - phpMyAdmin

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21243704/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:56:58  来源:igfitidea点击:

Call to undefined function __() error - phpMyAdmin

phpphpmyadmin

提问by meysam

When i want run phpMyAdmin on my browser, that show me this error:

当我想在我的浏览器上运行 phpMyAdmin 时,它显示了这个错误:

Fatal error: Call to undefined function __() in /usr/share/phpMyAdmin/libraries/core.lib.php on line 229
    Call Stack
    #   Time    Memory  Function    Location
    1   0.0010  344984  {main}( )   ../index.php:0
    2   0.0026  502720  require_once( '/usr/share/phpMyAdmin/libraries/common.inc.php' )    ../index.php:12
    3   0.0285  3836408 require( '/usr/share/phpMyAdmin/libraries/session.inc.php' )    ../common.inc.php:344
    4   0.0288  3846488 PMA_fatalError( )   ../session.inc.php:97

I use fedora 17 with PHP 5.5.7.

我将 Fedora 17 与 PHP 5.5.7 一起使用。

Any idea for solve problem?

解决问题的任何想法?

采纳答案by Isaac Bennetch

Check that your session directory is writable by the webserver process.

检查您的会话目录是否可由网络服务器进程写入。

The best way to do so is to create your own phpinfo file; in any web accessible folder create a file (you can call it test.php or phpinfo.php or whatever you'd like) with the following content:

最好的方法是创建自己的 phpinfo 文件;在任何 Web 可访问文件夹中创建一个包含以下内容的文件(您可以将其称为 test.php 或 phpinfo.php 或任何您喜欢的名称):

<?php
phpinfo();
?>

Open that file in your browser (http://localhost/test.phpor similar) and look for the line session.save_path. That's your session folder; make sure the permissions are suitable and see if that helps.

在浏览器(http://localhost/test.php或类似浏览器)中打开该文件并查找session.save_path. 那是你的会话文件夹;确保权限合适,看看是否有帮助。

More informationfrom a similar thread.

来自类似线程的更多信息

回答by itz_nsn

I just set up CentOS 7 and tried phpmyadmin and was having the same problem. Hope this helps

我刚刚设置了 CentOS 7 并尝试了 phpmyadmin 并且遇到了同样的问题。希望这可以帮助

I set the correct permissions to the sessions directory and restarted apache, even disabled SELinux but was shown the same error

我为 session 目录设置了正确的权限并重新启动了 apache,甚至禁用了 SELinux,但显示了相同的错误

I did not have the php-mbstring installed - once i did that, it worked

我没有安装 php-mbstring - 一旦我这样做了,它就起作用了

sudo yum install php-mbstring

Check the requirements for phpmyadmin

检查phpmyadmin的要求

回答by Tobias Beuving

For Debian users: (I ended up in this thread as a Debian user) I read @naveen 's answer and it appeared I didn't have php-mbstringinstalled, installing it solved my problem:

对于 Debian 用户:(我以 Debian 用户的身份加入了这个线程)我阅读了 @naveen 的回答,看来我没有安装php-mbstring,安装它解决了我的问题:

sudo apt-get install php-mbstring

(After installing php-mbstring, don't forget to restart Apache:)

(安装php-mbstring 后,不要忘记重启 Apache :)

sudo systemctl restart apache2

回答by BlissSol

Pretty much as other users had said... I'm running Debian 8 with PHP7 and ran into the issue, so just installing;

就像其他用户所说的那样......我正在使用 PHP7 运行 Debian 8 并遇到了这个问题,所以只需安装;

sudo apt-get install php7.0-mbstring

Followed by restarting the Apache service;

接着是重启Apache服务;

sudo service apache2 restart

And then phpmyadmin ran fine.

然后 phpmyadmin 运行良好。

回答by Alfred Huang

In my case using php-fpmunder CentOS 7, it was the reason @Issac pointed out, and just solved with:

在我的情况下,在CentOS 7下使用php-fpm,这是@Issac 指出的原因,并且刚刚解决了:

mkdir -p /var/lib/php/session
chown -R apache:apache /var/lib/php

Then solved.

然后解决了。

Just create the session folder, I think this direct solution can work on this specific case.

只需创建会话文件夹,我认为这个直接解决方案可以适用于这种特定情况。

WARNING:Before you do this, be sure to check if the /var/lib/phpfolder exists, and check which user is in use for the php-fpmprocess. If you are using nobody for the php-fpm process, set 777 permission for the /var/lib/php/sessioncan work well.

警告:在执行此操作之前,请务必检查该/var/lib/php文件夹是否存在,并检查该php-fpm进程正在使用哪个用户。如果您在 php-fpm 进程中使用了 nobody,请设置 777 权限以便/var/lib/php/session可以正常工作。

回答by cbmckay

In my case this error was intermittent and I'd had phpMyAdmin installed and running fine for years. Reading the answers here, it seemed the error might have something to do with the sessions.

在我的情况下,这个错误是间歇性的,我已经安装了 phpMyAdmin 并且运行良好多年。在这里阅读答案,似乎错误可能与会话有关。

On Ubuntu 16.04 the PHP sessions are in:/var/lib/php/sessionsand look like:

在 Ubuntu 16.04 上,PHP 会话位于:/var/lib/php/sessions并且看起来像:

$ sudo ls -al /var/lib/php/sessions/
total 128
drwx-wx-wt 2 root     root     73728 Mar  4 14:09 .
drwxr-xr-x 4 root     root      4096 Mar  8  2017 ..
-rw------- 1 www-data www-data    67 Mar  4 14:05 sess_dvg6vo1k1s1c0353rjk09g9vu1
-rw------- 1 www-data www-data    67 Mar  4 13:49 sess_e4ha0gl4f7gukku1o2uc4h5rs2
-rw------- 1 www-data www-data    67 Mar  4 14:05 sess_qhbve6k4a7svu6pk0lk568jgt0
-rw------- 1 www-data www-data    67 Mar  4 13:49 sess_sh48e898i7ad14oidsph08in10
-rw------- 1 www-data www-data 30044 Mar  4 14:04 sess_uvumc2341dvtfikl27kpile46pmfbon1

(That last one in the listing looked "funny" to me.)

(列表中的最后一个对我来说看起来很“有趣”。)

I first tried restarting apache2but the sessions apparently survive that. So I just deleted them. (Don't know of another way to clear them.) Upon refreshing the browser, the phpMyAdmin login displayed and everything is working as expected.

我首先尝试重新启动,apache2但会话显然幸免于难。所以我只是删除了它们。(不知道有没有其他方法可以清除它们。)刷新浏览器后,显示 phpMyAdmin 登录信息,一切都按预期工作。

回答by Jpsy

Check whether your PHP extensions are loaded. When the mysql or mysqli extensions fail to load, the result will be exactly this error (which is quite confusing). To check that your extensions are loading correctly, have a look at the output of the PHP function phpinfo() - all loaded extensions are listed there.

检查您的 PHP 扩展是否已加载。当 mysql 或 mysqli 扩展加载失败时,结果就是这个错误(这很令人困惑)。要检查您的扩展是否正确加载,请查看 PHP 函数 phpinfo() 的输出 - 所有加载的扩展都列在那里。

回答by Jpsy

If you are using a different user for a reason, e.g. when having httpd-itk(RHEL/CentOS/Fedora) or apache2-mpm-itk(Debian/Ubuntu) and your main user is not apacheor www-data, then do:

如果您出于某种原因使用不同的用户,例如在使用httpd-itk(RHEL/CentOS/Fedora) 或apache2-mpm-itk(Debian/Ubuntu) 而您的主要用户不是apache或 时www-data,请执行以下操作:

sudo usermod -a -G apache youruser

or

或者

sudo usermod -a -G www-data youruser

depending on your distribution, then phpMyAdmin will work.

根据您的发行版,phpMyAdmin 将起作用。

回答by Spikolynn

For me the error was in /usr/share/phpMyAdmin/libraries/sanitizing.lib.php.

对我来说,错误在/usr/share/phpMyAdmin/libraries/sanitizing.lib.php.

I increased php error reporting following this adviceand commented the offending line in sanitizing.lib.php by prepending //in front.

我按照这个建议增加了 php 错误报告, 并通过//在前面添加注释来评论 sanitizing.lib.php中的违规行。

Then the error was more descriptive: Fatal error: require_once(): Failed opening required '/usr/share/php/php-gettext/gettext.inc' (include_path='.') in /usr/share/phpmyadmin/libraries/common.inc.php on line 477

然后错误更具描述性: Fatal error: require_once(): Failed opening required '/usr/share/php/php-gettext/gettext.inc' (include_path='.') in /usr/share/phpmyadmin/libraries/common.inc.php on line 477

I noticed that I somehow lost the php-gettextdebian package, but after installing it phpMyAdmin worked again.

我注意到我不知何故丢失了php-gettextdebian 包,但安装后 phpMyAdmin 再次运行。

回答by Bachsau

I encountered this after a parse error in config.inc.php. Unfortunately, phpMyAdmin sets error_reporting(0)while reading the configuration file. Open libraries/Config.class.php, search for $old_error_reporting = error_reporting(0);and replace it with $old_error_reporting = error_reporting(E_ALL);to see what's going on. Of course you should revert this change later for security reasons.

我在 config.inc.php 解析错误后遇到了这个问题。不幸的是,phpMyAdminerror_reporting(0)在读取配置文件时设置。打开libraries/Config.class.php,搜索$old_error_reporting = error_reporting(0);并替换它,$old_error_reporting = error_reporting(E_ALL);看看发生了什么。当然,出于安全原因,您应该稍后恢复此更改。