1

I am trying to install following libraries on Oracle Linux 8 but not working. On Debian 11 after installing php8.1-fpm I run following command and it works.

sudo apt install php8.1-mysql php8.1-gd php8.1-mbstring php8.1-xml php8.1-zip php8.1-curl php8.1-imagick php8.1-soap

On Oracle Linux I have tried following but no luck. PHP FPM version installed is 7.2.24

sudo yum install php-mysql

sudo yum install php7.2-mysql

sudo yum install php7.2.24-mysql

All these commands failed saying Error: Unable to find a match:

How to install these libraries?

Frank Martin
  • 721
  • 2
  • 10
  • 23

1 Answers1

1

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.

Lacek
  • 6,585
  • 22
  • 28
  • Thanks. I didn't know installing phpfpm 8 was that easy. Yesterday I tried to install it using Remi repository but kept getting 403 error. Upon search I came to a thread here on ServerFault which said that it is only supported for x86 based systems and mine is Arm based. – Frank Martin Aug 17 '22 at 15:56