在 Centos 8 上安装较新版本的 php 时解压 rpm 包 php-common-7.3 时出错
Error unpacking rpm package php-common-7.3 while installing a newer version of php on Centos 8
我正在尝试安装 PHP 从 7.2 升级到 7.3。但是有问题出来了:
[root@123 ~]# dnf module reset php -y
Last metadata expiration check: 0:10:14 ago on Thu 08 Apr 2021 03:32:40 AM +03.
Dependencies resolved.
====================================================================================================================================================================================================================
Package Architecture Version Repository Size
====================================================================================================================================================================================================================
Resetting modules:
php
Transaction Summary
====================================================================================================================================================================================================================
Complete!
[root@123 ~]# dnf module enable php:remi-7.3 -y
Last metadata expiration check: 0:10:27 ago on Thu 08 Apr 2021 03:32:40 AM +03.
Dependencies resolved.
====================================================================================================================================================================================================================
Package Architecture Version Repository Size
====================================================================================================================================================================================================================
Enabling module streams:
php remi-7.3
Transaction Summary
====================================================================================================================================================================================================================
Complete!
[root@123 ~]# dnf module list php
Last metadata expiration check: 0:10:37 ago on Thu 08 Apr 2021 03:32:40 AM +03.
CentOS-8 - AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common [d], devel, minimal PHP scripting language
php 7.4 common [d], devel, minimal PHP scripting language
CentOS Linux 8 - AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common [d], devel, minimal PHP scripting language
php 7.4 common [d], devel, minimal PHP scripting language
Remi's Modular repository for Enterprise Linux 8 - x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 [e] common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language
php remi-8.0 common [d], devel, minimal PHP scripting language
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
[root@123 ~]# dnf install -y php php-cli php-common
Last metadata expiration check: 0:10:48 ago on Thu 08 Apr 2021 03:32:40 AM +03.
Package php-7.4.16-1.el8.remi.x86_64 is already installed.
Package php-cli-7.4.16-1.el8.remi.x86_64 is already installed.
Dependencies resolved.
====================================================================================================================================================================================================================
Package Architecture Version Repository Size
====================================================================================================================================================================================================================
Installing:
php-common x86_64 7.3.27-1.el8.remi remi-modular 1.1 M
Installing dependencies:
php-json x86_64 7.3.27-1.el8.remi remi-modular 75 k
Transaction Summary
====================================================================================================================================================================================================================
Install 2 Packages
Total download size: 1.2 M
Installed size: 12 M
Downloading Packages:
(1/2): php-json-7.3.27-1.el8.remi.x86_64.rpm 184 kB/s | 75 kB 00:00
(2/2): php-common-7.3.27-1.el8.remi.x86_64.rpm 1.4 MB/s | 1.1 MB 00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.1 MB/s | 1.2 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : php-json-7.3.27-1.el8.remi.x86_64 1/2
Error unpacking rpm package php-json-7.3.27-1.el8.remi.x86_64
Running scriptlet: php-common-7.3.27-1.el8.remi.x86_64 2/2
error: unpacking of archive failed on file /etc/php.d/20-json.ini: cpio: rename failed - Operation not permitted
error: php-json-7.3.27-1.el8.remi.x86_64: install failed
Installing : php-common-7.3.27-1.el8.remi.x86_64 2/2
Error unpacking rpm package php-common-7.3.27-1.el8.remi.x86_64
Verifying : php-common-7.3.27-1.el8.remi.x86_64 1/2
Verifying : php-json-7.3.27-1.el8.remi.x86_64 2/2
Failed:
php-common-7.3.27-1.el8.remi.x86_64 php-json-7.3.27-1.el8.remi.x86_64
Error: Transaction failed
[root@123 ~]#
我用谷歌搜索了这类问题,但没有合适的结果可以帮助我解决问题。
在安装 PHP 之前,我尝试 systemctl stop php-fpm httpd
。而且我还尝试删除 php
和其他一些与之相关的包。所有这些尝试都让我遇到了同样的问题。
OS Version: Centos 8
Web Server: Apache 2.4.46
谢谢。
删除/etc/php.d/
目录即可解决问题。然后重新安装PHP.
我正在尝试安装 PHP 从 7.2 升级到 7.3。但是有问题出来了:
[root@123 ~]# dnf module reset php -y
Last metadata expiration check: 0:10:14 ago on Thu 08 Apr 2021 03:32:40 AM +03.
Dependencies resolved.
====================================================================================================================================================================================================================
Package Architecture Version Repository Size
====================================================================================================================================================================================================================
Resetting modules:
php
Transaction Summary
====================================================================================================================================================================================================================
Complete!
[root@123 ~]# dnf module enable php:remi-7.3 -y
Last metadata expiration check: 0:10:27 ago on Thu 08 Apr 2021 03:32:40 AM +03.
Dependencies resolved.
====================================================================================================================================================================================================================
Package Architecture Version Repository Size
====================================================================================================================================================================================================================
Enabling module streams:
php remi-7.3
Transaction Summary
====================================================================================================================================================================================================================
Complete!
[root@123 ~]# dnf module list php
Last metadata expiration check: 0:10:37 ago on Thu 08 Apr 2021 03:32:40 AM +03.
CentOS-8 - AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common [d], devel, minimal PHP scripting language
php 7.4 common [d], devel, minimal PHP scripting language
CentOS Linux 8 - AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common [d], devel, minimal PHP scripting language
php 7.4 common [d], devel, minimal PHP scripting language
Remi's Modular repository for Enterprise Linux 8 - x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 [e] common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language
php remi-8.0 common [d], devel, minimal PHP scripting language
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
[root@123 ~]# dnf install -y php php-cli php-common
Last metadata expiration check: 0:10:48 ago on Thu 08 Apr 2021 03:32:40 AM +03.
Package php-7.4.16-1.el8.remi.x86_64 is already installed.
Package php-cli-7.4.16-1.el8.remi.x86_64 is already installed.
Dependencies resolved.
====================================================================================================================================================================================================================
Package Architecture Version Repository Size
====================================================================================================================================================================================================================
Installing:
php-common x86_64 7.3.27-1.el8.remi remi-modular 1.1 M
Installing dependencies:
php-json x86_64 7.3.27-1.el8.remi remi-modular 75 k
Transaction Summary
====================================================================================================================================================================================================================
Install 2 Packages
Total download size: 1.2 M
Installed size: 12 M
Downloading Packages:
(1/2): php-json-7.3.27-1.el8.remi.x86_64.rpm 184 kB/s | 75 kB 00:00
(2/2): php-common-7.3.27-1.el8.remi.x86_64.rpm 1.4 MB/s | 1.1 MB 00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.1 MB/s | 1.2 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : php-json-7.3.27-1.el8.remi.x86_64 1/2
Error unpacking rpm package php-json-7.3.27-1.el8.remi.x86_64
Running scriptlet: php-common-7.3.27-1.el8.remi.x86_64 2/2
error: unpacking of archive failed on file /etc/php.d/20-json.ini: cpio: rename failed - Operation not permitted
error: php-json-7.3.27-1.el8.remi.x86_64: install failed
Installing : php-common-7.3.27-1.el8.remi.x86_64 2/2
Error unpacking rpm package php-common-7.3.27-1.el8.remi.x86_64
Verifying : php-common-7.3.27-1.el8.remi.x86_64 1/2
Verifying : php-json-7.3.27-1.el8.remi.x86_64 2/2
Failed:
php-common-7.3.27-1.el8.remi.x86_64 php-json-7.3.27-1.el8.remi.x86_64
Error: Transaction failed
[root@123 ~]#
我用谷歌搜索了这类问题,但没有合适的结果可以帮助我解决问题。
在安装 PHP 之前,我尝试 systemctl stop php-fpm httpd
。而且我还尝试删除 php
和其他一些与之相关的包。所有这些尝试都让我遇到了同样的问题。
OS Version: Centos 8
Web Server: Apache 2.4.46
谢谢。
删除/etc/php.d/
目录即可解决问题。然后重新安装PHP.