could not find the driver: Apache server in Linux

could not find the driver: Apache server in Linux

mmarroquinmmarroquin Posts: 19Questions: 11Answers: 0

Hi Allan and community. I have a WebSite that first I tested in Server Linux with MySQL and Server Linux with Apache and all works fine.

But I need to connect a database in SQL SERVER.

My Apache server is mounted in Linux and I can't install de sqlsrv becasuse this driver only for Systems Windows.

When I'm trying to execute my web app I'm getting the error: could not find the driver

The info of my servers is:

DB SERVER: SQL SERVER 2008 in Windows
The server hosting my web Site: Apache, PHP versión 5.3.3 in Linux Red Hat.

I've installed a freetds but I don't know how modify the Driver/Sqlserver/Query.php for the connection.

I hope your help.
Thanks in advance.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Hi,

    FreeTDS is probably your best bet, although it isn't something I've used myself I'm afraid.

    What you need to do is change the DNS that is used to connect the PDO connection to the SQL Server to whatever FreeTDS requires (their documentation should cover this).

    Specifically look for this line in the Query.php file you mentioned:

    "sqlsrv:Server={$host}{$port};Database={$db}".self::dsnPostfix( $dsn ),

    Allan

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Looks like you might want to use dblib based on the PHP documentation.

    Allan

This discussion has been closed.