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?
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
):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:
Install PHP packages
Use
php-mysqlnd
instead ofphp-mysql
, andphp-pecl-zip
instead ofphp-zip
. The cURL extension is inphp-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: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.Install the ImageMagick and the necessary devel packages:
Then use
pecl
to install theimagick
extension:Just accept the default ("autodetect") as the prefix. After this is done, add the extension to the PHP config:
And it is done. The output of
php -m
should now containimagick
. 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.