Change PHP version
First, something of a side note: PHP 7.2 is obsolete, you should use at least PHP 7.4, but 8.0 is preferable. If you don't want to upgrade, skip this section.
You can change the (to-be) installed version of PHP with the following command (you can query the available versions with dnf module list php
):
dnf module enable php:8.0
This works only if no packages are installed, however, so if you do have any PHP packages installed (in which case the command above will spit an error), you should issue the following commands:
dnf module reset php
dnf install @php:8.0
dnf distro-sync
Install PHP packages
Use php-mysqlnd
instead of php-mysql
, and php-pecl-zip
instead of php-zip
. The cURL extension is in php-common
, so you don't need to install any extra packages for that. The rest should exist, except for the ImageMagick extension. For the sake of completeness, here is what you should install:
dnf install php php-common php-mysqlnd php-pecl-zip php-gd \
php-mbstring php-xml php-soap
Installing the ImageMagick extension is a little bit more tricky. Here is what you should do.
Install the oracle-epel-release-el8
package. It contains the ImageMagick package which you will need.
dnf install oracle-epel-release-el8
Install the ImageMagick and the necessary devel packages:
dnf install ImageMagick ImageMagick-devel php-devel php-pear make
Then use pecl
to install the imagick
extension:
pecl install imagick
Just accept the default ("autodetect") as the prefix. After this is done, add the extension to the PHP config:
echo "extension=imagick.so" > /etc/php.d/99-imagick.ini
And it is done. The output of php -m
should now contain imagick
. You will need to restart your web server in order for it to pick up the changed PHP libs.
Note that after this, upgrading PHP will require disabling the imagick
extension, and recompiling and re-enabling it after upgrade. Most probably this will be an issue only when changing major versions though.