Connecting PHP to Microsoft SQL Server on Debian/Ubuntu

1. Install FreeTDS and the PHP MS SQL extension

sudo apt-get install freetds-common freetds-bin unixodbc php5-sybase

Note: That is correct – the MS SQL extension is in the “php5-sybase” package.

2. Restart Apache

sudo /etc/init.d/apache2 restart

3. Test FreeTDS

tsql -H your.server.name -p 1433 -U yourusername -P yourpassword -D yourdatabasename

If it connects, it’s working.

Tags: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*