# PHP connection to Microsoft SQL Server

**URL:** https://forums.suse.com/t/php-connection-to-microsoft-sql-server/23734
**Category:** SLES Configure-Administer
**Created:** [March 15, 2013, 12:53am UTC](https://forums.suse.com/t/php-connection-to-microsoft-sql-server/23734 "2013-03-15T00:53:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![hydepark](https://avatars.discourse-cdn.com/v4/letter/h/d9b06d/32.png) [@hydepark](https://forums.suse.com/u/hydepark)
#### Post date: [March 15, 2013, 12:53am UTC](https://forums.suse.com/t/php-connection-to-microsoft-sql-server/23734/1 "2013-03-15T00:53:53Z")

</div>

We have a SLES 11 sp2 web server that we need to connect to a SQL Server 2005 database. We are running PHP 5.3. From our research there are two ways we could connect to SQL Server 2005 with php5.3; odbc\_connect or mssql\_connect, but we have not had any success doing this with either. For the ODBC option we can get php5-odbc installed, but are not able to find a driver compatible with SLES 11. The php5-mssql option does not appear in YAST.

What is the best way to connect to SQL Server 2005 with SLES 11 sp2?

---

<div class="post-metadata">

### Author: ![Jens-U](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@Jens-U](https://forums.suse.com/u/Jens-U)
#### Post date: [March 15, 2013, 5:12pm UTC](https://forums.suse.com/t/php-connection-to-microsoft-sql-server/23734/2 "2013-03-15T17:12:58Z")

</div>

Hi hydepark,

while I can give you no help at all with the MSSQL server question, I had a look at what pear might say about mssql:

# [CODE]# pear search mssql Retrieving data…0% Matched packages, channel [pear.php.net](http://pear.php.net):

Package Stable/(Latest) Local  
MDB2\_Driver\_mssql 1.5.0b4 (beta) mssql MDB2 driver[/CODE]

(this is from a SLES11SP2 install)

So “pear install mdb2\_driver\_mssql” might be an option for you.

Regards,  
Jens

---

<div class="post-metadata">

### Author: ![Jens-U](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@Jens-U](https://forums.suse.com/u/Jens-U)
#### Post date: [March 15, 2013, 5:22pm UTC](https://forums.suse.com/t/php-connection-to-microsoft-sql-server/23734/3 "2013-03-15T17:22:03Z")

</div>

Hi hydepark,

ignore my comment pointing you to the pear package… that will need the mssql extension to install 😉

But maybe “pecl” could be of help…

# [CODE]# pecl search sqlsrv Retrieving data…0% .Matched packages, channel [pecl.php.net](http://pecl.php.net):

Package Stable/(Latest) Local  
pdo\_sqlsrv 3.0.1 (stable) Microsoft Drivers for PHP for SQL Server (PDO\_SQLSRV)  
sqlsrv 3.0.1 (stable) Microsoft Drivers for PHP for SQL Server (SQLSRV)[/CODE]

I don’t know what it will require to compile, though.

Regards,  
Jens

---

<div class="post-metadata">

### Author: ![hydepark](https://avatars.discourse-cdn.com/v4/letter/h/d9b06d/32.png) [@hydepark](https://forums.suse.com/u/hydepark)
#### Post date: [March 15, 2013, 10:36pm UTC](https://forums.suse.com/t/php-connection-to-microsoft-sql-server/23734/4 "2013-03-15T22:36:41Z")

</div>

We will take a look at this. Thanks.
