On MS SQL Server there is a convenient way to help troubleshooting database server performance problems is to use the APP attribute, like this:
<?php
$dsn = 'DRIVER=FreeTDS;SERVERNAME=server1;DATABASE=testdb;APP=My PHP Application;UID=user;';
?>
This will show the "My PHP Application" text in ProgramName column of the sp_who2 procedure in MS SQL Server.