How can I run a php script ( to run a REST) command from within an MSSQL trigger?
I need this to run a REST command from a remote webservice just after a user logged in.
Are you sure you want to do this in the database layer?
Do you want your DB transaction to wait (and hold locks) while your REST request comes back? What happens if your web service is running slowly and times out after 1 minute?
It's possible but again, use with caution.
In SQL Server, there is an extended stored procedure called XP_CMDSHELL which will allow you to run scripts on the command line.
http://msdn.microsoft.com/en-us/library/ms175046.aspx
It's disabled by default but you can enable it like so:
EXEC sp_configure 'show advanced options', 1
GO
EXEC sp_configure'xp_cmdshell', 1
GO
Then in your trigger, you can call your script:
xp_cmdshell 'C:\path\to\php\php.exe -f C:\Path\to\your\script.php'
If you must do this in the database, I would strongly suggest just porting your php script to a .net language and executing it as a CLR stored procedure. That would be much more secure and less likely to cause problems.