1. First, install the PHP PDO_ODBC module in EA4.

2. Then we have to install Microsoft SQL Server ODBC Driver for Linux, download available at https://www.microsoft.com/en-us/download/details.aspx?id=28160

3. Following the instructions to install it and restart Apache and edit the file /etc/odbc.ini with this config:

Driver = SQL Server Native Client 11.0 Description = Database access Trace = No Server = 123.456.789.0 Port = 1433 Database = DatabaseName

Then on the PHP script add the following to connect to the database like this: 




try { 

    $db = new PDO("odbc:MSSQLServer", $username, $password); 

  } catch (PDOException $exception) { 

    echo $exception->getMessage(); 



$q = $db->query("SELECT * from Table"); 

while ( $d = $q->fetchObject() ) { 

var_export( $d ); 

آیا این پاسخ به شما کمک کرد؟ 0 کاربر این را مفید یافتند (0 نظرات)