Search code examples
phpupgradecentos8

Error unpacking rpm package php-common-7.3 while installing a newer version of php on Centos 8


I'm trying to install upgrade the PHP from 7.2 to 7.3. But there's a problem coming out:

[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 ~]#

I googled about this kind of problems, but there's no proper result could help me fix the issue. I tried to systemctl stop php-fpm httpd before installing PHP. And I also tried to remove php and some other packages related to it. All these attempts was leading me to the same issue.

OS Version: Centos 8
Web Server: Apache 2.4.46

Thanks.


Solution

  • The problem solved just by deleting the /etc/php.d/ directory. Then reinstall PHP.