Edit php.ini and activate extension.
extension=php_mssql.dll

The default way to connect to MSSQL Server with user names and passwords, but the mssql extension can be configured to use secure/trusted connections. So you have to set mssql.secure_connection = On in php.ini.
mssql.secure_connection = On

Restart the machine before execute the script.

To enable the 1433 port, if you are using MSSQL 2005 server. By port for TCP/IP is configured to take dynamically, so make it to 1433. Now, how follow the below step.

Microsoft SQL Server 2005 --> Configuration Tools --> SQL Server Configuration Manager

Part I (This will connect to your SQL EXPRESS)

- Now, under it go to SQL Server 2005 Network Configuration-->Protocols for SQLEXPRESS.

- Now, enable the VIA options by double click it.

- Then, open TCP/IP part and set TCP Dynamic Ports: 1433 (or something else) under Protocal-->IP Address-->IP All

Part II (This will connect to your MS SQL Server)

- Now, under it go to SQL Server 2005 Network Configuration-->Protocols for MSSQLSERVER.

- Now, enable the VIA options by double click it.

- Then, open TCP/IP part and set TCP Dynamic Ports: 1433 (or something else) under Protocal-->IP Address-->IP All

Error: The user is not associated with a trusted SQL Server Connection

http://decipherinfosys.wordpress.com/2008/11/14/the-user-is-not-associated-with-a-trusted-sql-server-connection/
Please enable the 1433 port, if you are using MSSQL 2005 server. By port for TCP/IP is configured to take dynamically, so make it to 1433. Now, how follow the below step.

Microsoft SQL Server 2005 --> Configuration Tools --> SQL Server Configuration Manager
Part I (This will connect to your SQL EXPRESS)
- Now, under it go to SQL Server 2005 Network Configuration-->Protocols for SQLEXPRESS.
- Now, enable the VIA options by double click it.
- Then, open TCP/IP part and set TCP Dynamic Ports: 1433 (or something else) under Protocal-->IP Address-->IP All

Part II (This will connect to your MS SQL Server)
- Now, under it go to SQL Server 2005 Network Configuration-->Protocols for MSSQLSERVER.
- Now, enable the VIA options by double click it.
- Then, open TCP/IP part and set TCP Dynamic Ports: 1433 (or something else) under Protocal-->IP Address-->IP All