Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP - SQL Server 2005 express to 2008 standard problem

I have a PHP app running happily on the following system:

  • web app: PHP version 5.2.3
  • OS: Windows Server 2003 Standard 32 bit
  • database: SQL Server 2005 (express)
  • web server: IIS 6

I'm trying to get the same thing running on the following:

  • web app: PHP version 5.2.11
  • OS: Windows Server 2008 Standard 64 bit
  • database: SQL Server 2008 Standard 64-bit
  • web server: IIS 7

After doing the install and setup I usually do, phpinfo() is running but there is no MSSQL section. I've looked around and found some MS documentation to set up the system using a php_sqlsrv.dll and tried that but it seems to use a different interface to connect to the database (no more mssql_connect(), now it's sqlsrv_connect()). Is this the only way to connect php to SQL Server 2008 or do I just have the setup wrong? If I can go back to PHP 5.2.3 and have it work, that will be fine but I didn't want to undo what I have if it won't help.

Thanks,

like image 756
Jeff Avatar asked Dec 04 '25 17:12

Jeff


2 Answers

There is an extensive tutorial on MSDN on how to do this.

http://msdn.microsoft.com/en-us/library/cc793139%28SQL.90%29.aspx

like image 98
λ Jonas Gorauskas Avatar answered Dec 07 '25 13:12

λ Jonas Gorauskas


The extension named php_mssql.dll is linked with an old Microsoft library (ntwdblib.dll). This library was last updated with MS SQL Server 6.5. It's a 32 bit library and does not support many of the new features introduced in newer versions of the database. It is possible to compile a version of the extension using FreeTDS. That will give access to the latest version of the TDS protocol. This also allows you to access SQL Server from a Linux/Unix based system.

The extension named php_sqlsrv.dll is developed and maintained by Microsoft gives much better support for the newer versions of SQL server and it should work in both the environments you describe.

like image 37
fmk_wa Avatar answered Dec 07 '25 13:12

fmk_wa