Skip to content
Advertisement

Installing pdo_sqlsrv driver in PHP 7.4 using CentOS 8

I have successfully installed php 7.4 with Remi packages in my CentOS 8 VPS (Used this guide https://www.digitalocean.com/community/tutorials/how-to-run-multiple-php-versions-on-one-server-using-apache-and-php-fpm-on-centos-8)

I have a VirtualHost in my Apache server, that points to my domain and load the required php version for that environment.

JavaScript

How do you enable the pdo_sqlsrv extension to a php 7.4 installation using Remi?

I’ve followed this guide: https://learn.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-ver15#installing-the-drivers-on-red-hat-7-and-8 but I think something went wrong.

If I do <?php echo phpinfo(); ?> I see that no modules are being loaded https://gyazo.com/d5a30969f06c49e78bf3473a07776492

Also if I check for the PHP version using php -v, this is the output:

JavaScript

EDIT:

I have also checked using this command yum list installed | grep php

and I have the following output. Notice the php-pdo from remi.

JavaScript

Advertisement

Answer

How do you enable the pdo_sqlsrv extension to a php 7.4 installation using Remi? php-sqlsrv.x86_64 5.8.1-1.el8.remi.7.4 @remi-modular php74-php-fpm.x86_64 7.4.12-1.el8.remi @remi-safe

You are confused betweeen php-* (single/default version) and php74-* (designed for multiple versions installation). Read the repository FAQ

For a proper installation, simply follow the Wizard instruction.

So, if you use php-fpm, you need php-sqlsrv (which is the simpler way, so recommended).

If you use php74-php-fpm, you need php74-php-sqlsrv.

JavaScript

You don’t have to build anything from source, and don’t have to modify any INI file.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement