Reputation: 57966
I am currrently making queries to my SQL Server using SQLCMD and I run this from PHPs exec() function. I was hoping to clarify that this isn't as efficient as the driver for SQL Server for PHP: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx. I am not sure if this is the same as https://www.php.net/manual/en/book.mssql.php?
I find that everytime I run an exec command it is quite a slow response and I was hoping to get this confirmed before I move to this new driver and implement it. Is there a performance difference using this Driver rather than using the exec function to launch SQLCMD?
I know this is a bit fluffy, but I really appreciate help on this decision.
Thanks all
Upvotes: 0
Views: 1365
Reputation: 401162
Launching another command, using exec or one of the other Program execution Functions, takes time ; using some PHP function/classes will probably always be faster -- and easier :
I would definitly go with using some function provided by a PHP extension, instead of using exec.
As a sidenote, in this specific case :
sqlsrv_*
functionsUpvotes: 1
Reputation: 25215
Ugg, yeah, get rid of your exec and use the php client library. You also won't have to deal with parsing your result sets back off the command line.
Upvotes: 2