Search code examples
sql-serverlaravelpdoredhatphp-7.1

Moving Laravel project from windows to RedHat 7 - Class 'PDO' not found


This question is not a duplicate of similar questions because I have installed PHP PDO extensions .

I have to move a Laravel 5.4 project which is now on Windows / IIS with Microsoft SQL Database to Linux Red Hat 7.4

I have: Apache httpd24 runing, with php 7.1 (rh-php71 package) installed with PDO, PDFO_ODBC extensions installed. PHP is working in php-fpm mode.

Everything works fine until the first access to SQL database (at the login :) ) when i get this error:

Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
Class 'PDO' not found

After 3 days of work and learn is there a solution another then migrate database to Maria or MySQL ?!

Later edit: I have added in php.ini:

extension=pdo.so

and now the new error is:

    Illuminate \ Database \ QueryException
    could not find driver (SQL: select top 1 * from [users] 
    where [email] = radu.cruceana@tiriacleasing.ro)

phpinfo() result Thank you!


Solution

  • As far I can tell, PDO alone can't connect to a sql server database.

    You should also install pdo_sqlsrv or connect via FreeTDS + pdo_dblib.