You can use a logon/password if MSSQL was installed to use Mixed Mode authentication. But I believe the default (and Microsoft's recommendation) is to use Windows Authentication. If you installed it with Windows Authentication, the code you have won't work (check the manual for the proper connection parameters in that case)
On Apache, this worked for me:
1) In php.ini, uncomment the extension for php_mssql.dll
2) Copy php_mssql.dll from php/ext to Apache's bin folder
3) Copy ntwdblib.dll to Windows' system32 folder
4) Restart Apache
Try this php page (assuming Apache is on the same machine as MSSQL (should display a Resource #)
<?php
echo mssql_connect('localhost');
?>
This is okay for trying it out. For a server connected to the internet you'll obviously want to make sure the account running Apache is as restricted on MSSQL as possible for your application (but Windows system administration is off topic here 🙂 )
MSSQL administration is easy if you have a licensed server with Enterprise Manager. But if you only have MSDE or Express you might want to use this tool to get started:
http://sqlbuddy.sourceforge.net/