【问题标题】:error when trying to reach localhost/phpmyadmin尝试访问 localhost/phpmyadmin 时出错
【发布时间】:2022-08-07 20:10:53
【问题描述】:

我正在尝试联系 phpmyadmin 以在 ubuntu 上配置我的数据库,但我不知道为什么我不能在浏览器中收到此错误,而且我仍然不明白它们的含义。我一直在寻找解决方案,但没有答案,或者至少没有正确的答案。它工作正常,我认为我没有安装任何新东西或其他东西,所以我不知道我必须搜索什么。

这是我得到的错误:

Fatal error: Uncaught Error: Call to undefined function PhpMyAdmin\\mb_strpos() in /usr/share/phpmyadmin/libraries/classes/Url.php:253 Stack trace:
#0 /usr/share/phpmyadmin/libraries/classes/Url.php(206): PhpMyAdmin\\Url::getArgSeparator() 
#1 /usr/share/phpmyadmin/libraries/classes/Url.php(169): PhpMyAdmin\\Url::getCommonRaw(Array, \'?\') 
#2 /usr/share/phpmyadmin/libraries/classes/Core.php(749): PhpMyAdmin\\Url::getCommon(Array) 
#3 /usr/share/phpmyadmin/libraries/classes/Core.php(330): PhpMyAdmin\\Core::linkURL(\'https://secure....\') 
#4 /usr/share/phpmyadmin/libraries/classes/Core.php(353): PhpMyAdmin\\Core::getPHPDocLink(\'book.mbstring.p...\') 
#5 /usr/share/phpmyadmin/libraries/classes/Core.php(973): PhpMyAdmin\\Core::warnMissingExtension(\'mbstring\') 
#6 /usr/share/phpmyadmin/libraries/common.inc.php(106): PhpMyAdmin\\Core::checkExtensions() 
#7 /usr/share/phpmyadmin/index.php(27): require_once(\'/usr/share/phpm...\') 
#8 {main} thrown in /usr/share/phpmyadmin/libraries/classes/Url.php on line 253
  • 尝试安装扩展 mbstring,sudo apt install php-mbstring
  • 不幸的是,这没有帮助

标签: mysql ubuntu phpmyadmin


【解决方案1】:

遇到同样的问题,不知道,你的问题后立即找到答案。谢谢你的这个问题。 您可能有多个版本的 PHP 和 sudo apt install php-mbstring 安装 mbstring 以获得最新版本。

  • 第一步获取PHP安装信息dpkg -l | grep php
dpkg -l | grep php

ii  libapache2-mod-php8.0                 1:8.0.21-2+ubuntu20.04.1+deb.sury.org+1 amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  libapache2-mod-php8.1                 8.1.8-1+ubuntu20.04.1+deb.sury.org+1    amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php                                   2:8.1+92+ubuntu20.04.1+deb.sury.org+2   all          server-side, HTML-embedded scripting language (default)
ii  php-bcmath                            2:7.4+75                                all          Bcmath module for PHP [default]
ii  php-bz2                               2:8.1+92+ubuntu20.04.1+deb.sury.org+2   all          bzip2 module for PHP [default]
ii  php-common                            2:75                                    all          Common files for PHP packages
ii  php-curl                              2:8.1+92+ubuntu20.04.1+deb.sury.org+2   all          CURL module for PHP [default]
ii  php-gd                                2:8.1+92+ubuntu20.04.1+deb.sury.org+2   all          GD module for PHP [default]
ii  php-google-recaptcha                  1.2.3-1                                 all          reCAPTCHA PHP client library
ii  php-mbstring                          2:8.1+92+ubuntu20.04.1+deb.sury.org+2   all          MBSTRING module for PHP [default]
ii  php-mcrypt                            3:1.0.5-1+ubuntu20.04.1+deb.sury.org+1  amd64        PHP bindings for the libmcrypt library
ii  php-mysql                             2:8.1+92+ubuntu20.04.1+deb.sury.org+2   all          MySQL module for PHP [default]
ii  php-phpmyadmin-motranslator           5.0.0-1                                 all          translation API for PHP using Gettext MO files
ii  php-phpmyadmin-shapefile              2.1-3                                   all          translation API for PHP using Gettext MO files
ii  php-phpmyadmin-sql-parser             4.6.1-2                                 all          validating SQL lexer and parser
ii  php-phpseclib                         2.0.23-2                                all          implementations of an arbitrary-precision integer arithmetic library
ii  php-psr-cache                         1.0.1-2                                 all          Common interface for caching libraries
ii  php-psr-container                     1.0.0-2                                 all          Common Container Interface (PHP FIG PSR-11)
ii  php-psr-log                           1.1.2-1                                 all          common interface for logging libraries
ii  php-symfony-cache                     4.3.8+dfsg-1ubuntu1                     all          Symfony Cache component with PSR-6, PSR-16, and tags
ii  php-symfony-cache-contracts           1.1.8-1                                 all          Generic abstractions related to caching
ii  php-symfony-expression-language       4.3.8+dfsg-1ubuntu1                     all          compile and evaluate expressions
ii  php-symfony-service-contracts         1.1.8-1                                 all          Generic abstractions related to writing services
ii  php-symfony-var-exporter              4.3.8+dfsg-1ubuntu1                     all          export serializable PHP data structure to plain PHP code
ii  php-tcpdf                             6.3.5+dfsg1-1                           all          PHP class for generating PDF files on-the-fly
ii  php-twig                              2.12.5-1                                all          Flexible, fast, and secure template engine for PHP
ii  php-twig-extensions                   1.5.4-1                                 all          extensions for the Twig template system
ii  php-xdebug                            2.9.2+2.8.1+2.5.5-1build1               amd64        Xdebug Module for PHP
ii  php-xml                               2:8.1+92+ubuntu20.04.1+deb.sury.org+2   all          DOM, SimpleXML, WDDX, XML, and XSL module for PHP [default]
ii  php-zip                               2:8.1+92+ubuntu20.04.1+deb.sury.org+2   all          Zip module for PHP [default]
ii  php7.4-bcmath                         1:7.4.30-5+ubuntu20.04.1+deb.sury.org+1 amd64        Bcmath module for PHP
rc  php7.4-bz2                            7.4.3-4ubuntu2.12                       amd64        bzip2 module for PHP
ii  php7.4-cli                            1:7.4.30-5+ubuntu20.04.1+deb.sury.org+1 amd64        command-line interpreter for the PHP scripting language
ii  php7.4-common                         1:7.4.30-5+ubuntu20.04.1+deb.sury.org+1 amd64        documentation, examples and common module for PHP
rc  php7.4-curl                           7.4.3-4ubuntu2.12                       amd64        CURL module for PHP
ii  php7.4-fpm                            1:7.4.30-5+ubuntu20.04.1+deb.sury.org+1 amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
rc  php7.4-gd                             7.4.3-4ubuntu2.12                       amd64        GD module for PHP
ii  php7.4-json                           1:7.4.30-5+ubuntu20.04.1+deb.sury.org+1 amd64        JSON module for PHP
ii  php7.4-mbstring                       1:7.4.30-5+ubuntu20.04.1+deb.sury.org+1 amd64        MBSTRING module for PHP
ii  php7.4-mysql                          1:7.4.30-5+ubuntu20.04.1+deb.sury.org+1 amd64        MySQL module for PHP
ii  php7.4-opcache                        1:7.4.30-5+ubuntu20.04.1+deb.sury.org+1 amd64        Zend OpCache module for PHP
ii  php7.4-readline                       1:7.4.30-5+ubuntu20.04.1+deb.sury.org+1 amd64        readline module for PHP
rc  php7.4-xml                            7.4.3-4ubuntu2.12                       amd64        DOM, SimpleXML, XML, and XSL module for PHP
rc  php7.4-zip                            7.4.3-4ubuntu2.12                       amd64        Zip module for PHP
ii  php8.0                                1:8.0.21-2+ubuntu20.04.1+deb.sury.org+1 all          server-side, HTML-embedded scripting language (metapackage)
ii  php8.0-cli                            1:8.0.21-2+ubuntu20.04.1+deb.sury.org+1 amd64        command-line interpreter for the PHP scripting language
ii  php8.0-common                         1:8.0.21-2+ubuntu20.04.1+deb.sury.org+1 amd64        documentation, examples and common module for PHP
ii  php8.0-fpm                            1:8.0.21-2+ubuntu20.04.1+deb.sury.org+1 amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php8.0-mbstring                       1:8.0.21-2+ubuntu20.04.1+deb.sury.org+1 amd64        MBSTRING module for PHP
ii  php8.0-opcache                        1:8.0.21-2+ubuntu20.04.1+deb.sury.org+1 amd64        Zend OpCache module for PHP
ii  php8.0-readline                       1:8.0.21-2+ubuntu20.04.1+deb.sury.org+1 amd64        readline module for PHP
ii  php8.1                                8.1.8-1+ubuntu20.04.1+deb.sury.org+1    all          server-side, HTML-embedded scripting language (metapackage)
ii  php8.1-bz2                            8.1.8-1+ubuntu20.04.1+deb.sury.org+1    amd64        bzip2 module for PHP
ii  php8.1-cli                            8.1.8-1+ubuntu20.04.1+deb.sury.org+1    amd64        command-line interpreter for the PHP scripting language
ii  php8.1-common                         8.1.8-1+ubuntu20.04.1+deb.sury.org+1    amd64        documentation, examples and common module for PHP
ii  php8.1-curl                           8.1.8-1+ubuntu20.04.1+deb.sury.org+1    amd64        CURL module for PHP
ii  php8.1-gd                             8.1.8-1+ubuntu20.04.1+deb.sury.org+1    amd64        GD module for PHP
ii  php8.1-mbstring                       8.1.8-1+ubuntu20.04.1+deb.sury.org+1    amd64        MBSTRING module for PHP
ii  php8.1-mcrypt                         3:1.0.5-1+ubuntu20.04.1+deb.sury.org+1  amd64        PHP bindings for the libmcrypt library
ii  php8.1-mysql                          8.1.8-1+ubuntu20.04.1+deb.sury.org+1    amd64        MySQL module for PHP
ii  php8.1-opcache                        8.1.8-1+ubuntu20.04.1+deb.sury.org+1    amd64        Zend OpCache module for PHP
ii  php8.1-readline                       8.1.8-1+ubuntu20.04.1+deb.sury.org+1    amd64        readline module for PHP
ii  php8.1-xml                            8.1.8-1+ubuntu20.04.1+deb.sury.org+1    amd64        DOM, SimpleXML, XML, and XSL module for PHP
ii  php8.1-zip                            8.1.8-1+ubuntu20.04.1+deb.sury.org+1    amd64        Zip module for PHP
ii  phpmyadmin                            4:4.9.5+dfsg1-2                         all          MySQL web administration tool

如你所见,我有php8.1php8.0php7.4

  • 第二步检查当前版本以及您将使用什么版本

我目前正在使用php7.4(它可以在PHPINFO文件中显示,其中包含该代码<?php phpinfo();?>我已将此文件创建为index.php并将其放入/var/www/html并在浏览器中以localhost访问) 对于php7.4,您必须安装sudo apt-get install php7.4-mbstring 可能其他模块也丢失了。

  • 第三步使用sudo apt-get install php7.4-mbstring安装正确的版本
  • 第四步 要在 PHP 版本之间切换,请使用 sw on sudo a2enmod php7.4 和 sw off sudo a2dismod php8.1 作为示例。
  • 确保您使用sudo ln -s /usr/share/phpmyadmin/ /var/www/phpmyadmin 获得可见的phpmyadmin,它会在同一文件夹中创建链接,并且非常有用

【讨论】:

    猜你喜欢
    • 2016-04-19
    • 2014-08-01
    • 2015-06-25
    • 1970-01-01
    • 2012-11-01
    • 2013-03-02
    • 2012-07-06
    • 1970-01-01
    • 2014-01-16
    相关资源
    最近更新 更多