安装 PHPMyAdmin 时出现依赖错误

安装 PHPMyAdmin 时出现依赖错误

我有一个通过 ISPCONFIG3 和 CENTOS 管理的小型 VPS,最近我尝试将其 PHP 版本从 5.4 更新到 5.6 和 7.2,以便安装 Wordpress。我遇到了很多错误,但终于完成了。之后,我的 PHPMYADMIN 不起作用。所以我尝试重新安装它。但每次都出现许多依赖性错误。我尝试了网上的每个命令,但没有任何变化。

yum --enablerepo=remi,remi-php56  install phpMyAdmin

我也尝试使用 remi、remi-test、remi-php72 等使用此命令。

每次我收到这些错误:

Loaded plugins: fastestmirror, langpacks, priorities
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.ovh.net
 * epel: mirrors.coreix.net
 * extras: centos.mirrors.ovh.net
 * remi: remi.mirror.ate.info
 * remi-php56: remi.mirror.ate.info
 * remi-php72: remi.mirror.ate.info
 * remi-safe: remi.mirror.ate.info
 * updates: centos.mirrors.ovh.net
 * webtatic: uk.repo.webtatic.com
1803 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package phpMyAdmin.noarch 0:4.4.15.10-3.el7 will be installed
--> Processing Dependency: php-php-gettext for package: phpMyAdmin-4.4.15.10-3.el7.noarch
--> Processing Dependency: php-tcpdf for package: phpMyAdmin-4.4.15.10-3.el7.noarch
--> Processing Dependency: php-tcpdf-dejavu-sans-fonts for package: phpMyAdmin-4.4.15.10-3.el7.noarch
--> Running transaction check
---> Package php-php-gettext.noarch 0:1.0.12-1.el7 will be installed
---> Package php-tcpdf.noarch 0:6.2.26-1.el7 will be installed
--> Processing Dependency: php-tidy for package: php-tcpdf-6.2.26-1.el7.noarch
---> Package php-tcpdf-dejavu-sans-fonts.noarch 0:6.2.26-1.el7 will be installed
--> Running transaction check
---> Package php-tidy.x86_64 0:5.4.16-9.el7 will be installed
--> Processing Dependency: php(zend-abi) = 20100525-64 for package: php-tidy-5.4.16-9.el7.x86_64
--> Processing Dependency: php(api) = 20100412-64 for package: php-tidy-5.4.16-9.el7.x86_64
--> Finished Dependency Resolution
Error: Package: php-tidy-5.4.16-9.el7.x86_64 (epel)
           Requires: php(api) = 20100412-64
           Installed: php-common-7.2.24-1.el7.remi.x86_64 (@remi-php72)
               php(api) = 20170718-64
           Available: php-common-5.4.16-46.el7.x86_64 (base)
               php(api) = 20100412-64
           Available: php-common-5.4.45-17.el7.remi.x86_64 (remi)
               php(api) = 20100412-64
           Available: php-common-5.4.45-18.el7.remi.x86_64 (remi)
               php(api) = 20100412-64
           Available: php-common-5.6.40-13.el7.remi.x86_64 (remi-php56)
               php(api) = 20131106-64
           Available: php-common-5.6.40-14.el7.remi.x86_64 (remi-php56)
               php(api) = 20131106-64
           Available: php-common-7.2.23-1.el7.remi.x86_64 (remi-php72)
               php(api) = 20170718-64
           Available: php55w-common-5.5.38-1.w7.x86_64 (webtatic)
               php(api) = 20121113-64
           Available: php56w-common-5.6.40-1.w7.x86_64 (webtatic)
               php(api) = 20131106-64
           Available: php70w-common-7.0.33-1.w7.x86_64 (webtatic)
               php(api) = 20151012-64
           Available: php71w-common-7.1.26-1.w7.x86_64 (webtatic)
               php(api) = 20160303-64
           Available: php71w-common-7.1.27-1.w7.x86_64 (webtatic)
               php(api) = 20160303-64
           Available: php71w-common-7.1.28-1.w7.x86_64 (webtatic)
               php(api) = 20160303-64
           Available: php71w-common-7.1.29-1.w7.x86_64 (webtatic)
               php(api) = 20160303-64
           Available: php71w-common-7.1.30-1.w7.x86_64 (webtatic)
               php(api) = 20160303-64
           Available: php71w-common-7.1.31-1.w7.x86_64 (webtatic)
               php(api) = 20160303-64
           Available: php71w-common-7.1.32-1.w7.x86_64 (webtatic)
               php(api) = 20160303-64
           Available: php71w-common-7.1.33-1.w7.x86_64 (webtatic)
               php(api) = 20160303-64
           Available: php72w-common-7.2.14-1.w7.x86_64 (webtatic)
               php(api) = 20170718-64
           Available: php72w-common-7.2.16-1.w7.x86_64 (webtatic)
               php(api) = 20170718-64
           Available: php72w-common-7.2.17-1.w7.x86_64 (webtatic)
               php(api) = 20170718-64
           Available: php72w-common-7.2.19-1.w7.x86_64 (webtatic)
               php(api) = 20170718-64
           Available: php72w-common-7.2.21-1.w7.x86_64 (webtatic)
               php(api) = 20170718-64
           Available: php72w-common-7.2.22-1.w7.x86_64 (webtatic)
               php(api) = 20170718-64
           Available: php72w-common-7.2.24-1.w7.x86_64 (webtatic)
               php(api) = 20170718-64
Error: Package: php-tidy-5.4.16-9.el7.x86_64 (epel)
           Requires: php(zend-abi) = 20100525-64
           Installed: php-common-7.2.24-1.el7.remi.x86_64 (@remi-php72)
               php(zend-abi) = 20170718-64
           Available: php-common-5.4.16-46.el7.x86_64 (base)
               php(zend-abi) = 20100525-64
           Available: php-common-5.4.45-17.el7.remi.x86_64 (remi)
               php(zend-abi) = 20100525-64
           Available: php-common-5.4.45-18.el7.remi.x86_64 (remi)
               php(zend-abi) = 20100525-64
           Available: php-common-5.6.40-13.el7.remi.x86_64 (remi-php56)
               php(zend-abi) = 20131226-64
           Available: php-common-5.6.40-14.el7.remi.x86_64 (remi-php56)
               php(zend-abi) = 20131226-64
           Available: php-common-7.2.23-1.el7.remi.x86_64 (remi-php72)
               php(zend-abi) = 20170718-64
           Available: php55w-common-5.5.38-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20121212-64
           Available: php56w-common-5.6.40-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20131226-64
           Available: php70w-common-7.0.33-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20151012-64
           Available: php71w-common-7.1.26-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20160303-64
           Available: php71w-common-7.1.27-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20160303-64
           Available: php71w-common-7.1.28-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20160303-64
           Available: php71w-common-7.1.29-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20160303-64
           Available: php71w-common-7.1.30-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20160303-64
           Available: php71w-common-7.1.31-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20160303-64
           Available: php71w-common-7.1.32-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20160303-64
           Available: php71w-common-7.1.33-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20160303-64
           Available: php72w-common-7.2.14-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20170718-64
           Available: php72w-common-7.2.16-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20170718-64
           Available: php72w-common-7.2.17-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20170718-64
           Available: php72w-common-7.2.19-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20170718-64
           Available: php72w-common-7.2.21-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20170718-64
           Available: php72w-common-7.2.22-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20170718-64
           Available: php72w-common-7.2.24-1.w7.x86_64 (webtatic)
               php(zend-abi) = 20170718-64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

现在我使用数据库就像使用 NC(MS-DOS)一样;)

请帮助我重新安装我的 PHPMYADMIN。

答案1

为了解决这个问题,正如@EOhm所说,我们必须手动安装 PHPMyAdmin 4.9.1:

yum install -y wget php php-pdo php-pecl-zip php-json php-common php-fpm php-mbstring php-cli php-mysqlnd
yum install -y php-json php-mbstring
wget https://files.phpmyadmin.net/phpMyAdmin/4.9.1/phpMyAdmin-4.9.1-all-languages.tar.gz
tar -zxvf phpMyAdmin-4.9.1-all-languages.tar.gz
mv phpMyAdmin-4.9.1-all-languages /usr/share/phpMyAdmin
cp -pr /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php

编辑配置文件:

nano /usr/share/phpMyAdmin/config.inc.php

更新 blowfish 的秘密:

$cfg['blowfish_secret'] = 'bo95yavJ;V,1PzSlxyFwtyMJ}WmG98-6';

使用 PHPMyAdmin 表加载 MySQL:

mysql < /usr/share/phpMyAdmin/sql/create_tables.sql -u root -p

可能需要一些 MySQL 定义:(可选)

sudo mysql -u root
CREATE DATABASE phpmyadmin DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL ON phpmyadmin.* TO 'phpmyadmin'@'localhost' IDENTIFIED BY 'your_preferred_password';
FLUSH PRIVILEGES;
EXIT;

创建 apache web 服务器别名:

nano /etc/httpd/conf.d/phpMyAdmin.conf

将以下内容复制并粘贴到上述文件中:

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny> 
      Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

其他配置:

mkdir /usr/share/phpMyAdmin/tmp
chmod 777 /usr/share/phpMyAdmin/tmp
chown -R apache:apache /usr/share/phpMyAdmin
systemctl restart httpd
yum install -y policycoreutils-python-utils
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/phpMyAdmin/'
semanage fcontext -a -t httpd_sys_rw_content_t "/usr/share/phpMyAdmin/tmp(/.*)?"
restorecon -Rv '/usr/share/phpMyAdmin/'
firewall-cmd --permanent --add-service=http
firewall-cmd --reload

完成这些步骤后,我的问题解决了。谢谢。

答案2

您没有从 remi 安装 phpMyAdmin(目前版本为 EL7 的 phpMyAdmin-4.9.1)。可能是您的优先级搞错了(remi 应该比 epel、base 等具有更高或至少相等的优先级)。
否则:
如果您使用 yum install 指定版本号会发生什么情况?yum --enablrepo remi phpMyAdmin-4.9

相关内容