无法打开所需的“PhpMyAdmin/MoTranslator/autoload.php”

无法打开所需的“PhpMyAdmin/MoTranslator/autoload.php”

我全新安装了20.04php 7并且刚刚apt install phpmyadmin按照所有步骤运行,现在当导航到 时,localhost/phpmyadmin我看到:

[Sun Aug 08 14:51:58.410439 2021] [php7:warn] [pid 84550] [client 93.115.195.232:6537] PHP Warning:  require_once(PhpMyAdmin/MoTranslator/autoload.php): failed to open stream: No such file or directory in /usr/share/phpmyadmin/autoload.php on line 2
[Sun Aug 08 14:51:58.410486 2021] [php7:error] [pid 84550] [client 93.115.195.232:6537] PHP Fatal error:  require_once(): Failed opening required 'PhpMyAdmin/MoTranslator/autoload.php' (include_path='/usr/share/phpmyadmin') in /usr/share/phpmyadmin/autoload.php on line 2

我的autoload.php文件如下所示:

<?php
require_once 'PhpMyAdmin/MoTranslator/autoload.php';
require_once 'PhpMyAdmin/ShapeFile/autoload.php';
require_once 'PhpMyAdmin/SqlParser/autoload.php';
require_once 'Symfony/Component/ExpressionLanguage/autoload.php';
require_once 'phpseclib/autoload.php';
require_once 'Twig/autoload.php';
require_once 'Twig-Extensions/autoload.php';
require_once 'ReCaptcha/autoload.php';
require_once 'Psr/Container/autoload.php';
@include_once 'tcpdf/tcpdf.php';

我根本不知道PhpMyAdmin参考什么?

-rw-r--r--   1 root root  1560 Mar 21  2020 ajax.php
-rw-r--r--   1 root root 44058 Aug  8 15:02 autoload.php
-rw-r--r--   1 root root  1750 Mar 21  2020 browse_foreigners.php
-rw-r--r--   1 root root  3194 Mar 21  2020 changelog.php
-rw-r--r--   1 root root   856 Mar 21  2020 chk_rel.php
-rw-r--r--   1 root root  4516 Mar 21  2020 config.sample.inc.php
-rw-r--r--   1 root root  5674 Mar 21  2020 db_central_columns.php
-rw-r--r--   1 root root  5878 Mar 21  2020 db_datadict.php
-rw-r--r--   1 root root  7706 Mar 21  2020 db_designer.php
-rw-r--r--   1 root root   271 Mar 21  2020 db_events.php
-rw-r--r--   1 root root  4631 Mar 21  2020 db_export.php
-rw-r--r--   1 root root   899 Mar 21  2020 db_import.php
-rw-r--r--   1 root root  1038 Mar 21  2020 db_multi_table_query.php
-rw-r--r--   1 root root  9860 Mar 21  2020 db_operations.php
-rw-r--r--   1 root root  4859 Mar 21  2020 db_qbe.php
-rw-r--r--   1 root root   365 Mar 21  2020 db_routines.php
-rw-r--r--   1 root root  1997 Mar 21  2020 db_search.php
-rw-r--r--   1 root root   746 Mar 21  2020 db_sql_autocomplete.php
-rw-r--r--   1 root root   485 Mar 21  2020 db_sql_format.php
-rw-r--r--   1 root root   952 Mar 21  2020 db_sql.php
-rw-r--r--   1 root root  1011 Mar 21  2020 db_structure.php
-rw-r--r--   1 root root  4415 Mar 21  2020 db_tracking.php
-rw-r--r--   1 root root   273 Mar 21  2020 db_triggers.php
drwxr-xr-x   2 root root  4096 Aug  8 14:50 doc/
-rw-r--r--   1 root root  4608 Mar 21  2020 error_report.php
-rw-r--r--   1 root root 15919 Mar 21  2020 export.php
-rw-r--r--   1 root root 22486 Mar 21  2020 favicon.ico
-rw-r--r--   1 root root 15984 Mar 21  2020 gis_data_editor.php
-rw-r--r--   1 root root 23976 Mar 21  2020 import.php
-rw-r--r--   1 root root  3463 Mar 21  2020 import_status.php
-rw-r--r--   1 root root 20259 Mar 21  2020 index.php
drwxr-xr-x   7 root root  4096 Aug  8 14:50 js/
drwxr-xr-x   6 root root  4096 Aug  8 14:50 libraries/
-rw-r--r--   1 root root   894 Mar 21  2020 license.php
-rw-r--r--   1 root root  1430 Mar 21  2020 lint.php
drwxr-xr-x  47 root root  4096 Aug  8 14:50 locale/
-rw-r--r--   1 root root   311 Mar 21  2020 logout.php
-rw-r--r--   1 root root  2309 Mar 21  2020 navigation.php
-rw-r--r--   1 root root  4143 Mar 21  2020 normalization.php
-rw-r--r--   1 root root   507 Mar 21  2020 phpinfo.php
-rw-r--r--   1 root root   740 Mar 21  2020 phpmyadmin.css.php
-rw-r--r--   1 root root  2493 Mar 21  2020 prefs_forms.php
-rw-r--r--   1 root root 14356 Mar 21  2020 prefs_manage.php
-rw-r--r--   1 root root  1594 Mar 21  2020 prefs_twofactor.php
-rw-r--r--   1 root root  1213 Mar 21  2020 print.css
-rw-r--r--   1 root root   653 Mar 21  2020 schema_export.php
-rw-r--r--   1 root root   785 Mar 21  2020 server_binlog.php
-rw-r--r--   1 root root   818 Mar 21  2020 server_collations.php
-rw-r--r--   1 root root   798 Mar 21  2020 server_databases.php
-rw-r--r--   1 root root   784 Mar 21  2020 server_engines.php
-rw-r--r--   1 root root  1085 Mar 21  2020 server_export.php
-rw-r--r--   1 root root   634 Mar 21  2020 server_import.php
-rw-r--r--   1 root root   784 Mar 21  2020 server_plugins.php
-rw-r--r--   1 root root 14184 Mar 21  2020 server_privileges.php
-rw-r--r--   1 root root  2432 Mar 21  2020 server_replication.php
-rw-r--r--   1 root root   698 Mar 21  2020 server_sql.php
-rw-r--r--   1 root root   862 Mar 21  2020 server_status_advisor.php
-rw-r--r--   1 root root  2962 Mar 21  2020 server_status_monitor.php
-rw-r--r--   1 root root   897 Mar 21  2020 server_status.php
-rw-r--r--   1 root root  1879 Mar 21  2020 server_status_processes.php
-rw-r--r--   1 root root  1423 Mar 21  2020 server_status_queries.php
-rw-r--r--   1 root root  1562 Mar 21  2020 server_status_variables.php
-rw-r--r--   1 root root  1872 Mar 21  2020 server_user_groups.php
-rw-r--r--   1 root root   798 Mar 21  2020 server_variables.php
-rw-r--r--   1 root root  1089 Mar 21  2020 show_config_errors.php
drwxr-xr-x   2 root root  4096 Aug  8 14:50 sql/
-rw-r--r--   1 root root  6352 Mar 21  2020 sql.php
-rw-r--r--   1 root root  3754 Mar 21  2020 tbl_addfield.php
-rw-r--r--   1 root root  6334 Mar 21  2020 tbl_change.php
-rw-r--r--   1 root root   972 Mar 21  2020 tbl_chart.php
-rw-r--r--   1 root root  3365 Mar 21  2020 tbl_create.php
-rw-r--r--   1 root root  2431 Mar 21  2020 tbl_export.php
-rw-r--r--   1 root root   999 Mar 21  2020 tbl_find_replace.php
-rw-r--r--   1 root root  1763 Mar 21  2020 tbl_get_field.php
-rw-r--r--   1 root root  1540 Mar 21  2020 tbl_gis_visualization.php
-rw-r--r--   1 root root   684 Mar 21  2020 tbl_import.php
-rw-r--r--   1 root root  1401 Mar 21  2020 tbl_indexes.php
-rw-r--r--   1 root root 15446 Mar 21  2020 tbl_operations.php
-rw-r--r--   1 root root   452 Mar 21  2020 tbl_recent_favorite.php
-rw-r--r--   1 root root  2375 Mar 21  2020 tbl_relation.php
-rw-r--r--   1 root root 16972 Mar 21  2020 tbl_replace.php
-rw-r--r--   1 root root  5005 Mar 21  2020 tbl_row_action.php
-rw-r--r--   1 root root  1130 Mar 21  2020 tbl_select.php
-rw-r--r--   1 root root  1176 Mar 21  2020 tbl_sql.php
-rw-r--r--   1 root root  2042 Mar 21  2020 tbl_structure.php
-rw-r--r--   1 root root  5797 Mar 21  2020 tbl_tracking.php
-rw-r--r--   1 root root   141 Mar 21  2020 tbl_triggers.php
-rw-r--r--   1 root root  1049 Mar 21  2020 tbl_zoom_select.php
drwxr-xr-x  19 root root  4096 Aug  8 14:50 templates/
drwxr-xr-x   4 root root  4096 Aug  8 14:50 themes/
-rw-r--r--   1 root root   956 Mar 21  2020 themes.php
-rw-r--r--   1 root root  1910 Mar 21  2020 transformation_overview.php
-rw-r--r--   1 root root  4617 Mar 21  2020 transformation_wrapper.php
-rw-r--r--   1 root root  1296 Mar 21  2020 url.php
-rw-r--r--   1 root root  1934 Mar 21  2020 user_password.php
-rw-r--r--   1 root root  1085 Mar 21  2020 version_check.php
-rw-r--r--   1 root root  6604 Mar 21  2020 view_create.php
-rw-r--r--   1 root root  3866 Mar 21  2020 view_operations.php

答案1

我在装有 PHP 7.4.3 的 Ubuntu 20.04 上遇到了同样的问题。模块 autoload.php 位于 /usr/share/php/PhpMyAdmin/MoTranslator/,但 PHP 不知道此路径(在您的情况下,包含路径仅包含此路径,如错误消息所示:include_path='/usr/share/phpmyadmin')。

为了解决这个问题,我编辑了 php.ini 文件 (/etc/php/7.4/apache2/php.ini) 中的 php include_path,以便它在末尾包含 /usr/share/php/。例如:

include_path =“。:/php/includes:/usr/share/pear/:/usr/lib/php/:/usr/共享/php/

(我刚刚将:/usr/share/php/添加到我现有的include_path字符串中)

然后重新启动 apache 服务器后,我的 phpmyadmin 页面就可以正确加载了

答案2

由于我有一个旧的 Apache 配置(我正在从 Debian 11 恢复到 Ubuntu 22.04),所以发生了这种情况。

我需要:

Alias /phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin>
    Options SymLinksIfOwnerMatch
    DirectoryIndex index.php

    # limit libapache2-mod-php to files and directories necessary by pma
    <IfModule mod_php7.c>
        php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
        php_admin_value open_basedir /usr/share/phpmyadmin/:/usr/share/doc/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/:/usr/share/javascript/
    </IfModule>

</Directory>

# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/templates>
    Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/libraries>
    Require all denied
</Directory>

相关内容