Add SQLSRV driver support in EasyPHP Devserver

Recently I had to develop a new project in php, jquery, ajax and javascript which needs a Microsoft SQL database connection. For developing purposes I like to use Easyphp Devserver , an all in one package like WampServer or XAMPP.  I Prefer this one because it seems more lightly and less intrusive for my overweighted system.

By default this php configuration didn’t have a sqlsrv_connect support and my connection got an error:

Fatal error: Call to undefined function sqlsrv_connect() in

At this point I was pretty sure that it’s a miss config (It wasn’t my first time) so had searched on Microsoft for specific driver, but official one’s didn’t work for me, fortunately I had found another one not official and it worked.

Download the driver:

Unofficial Microsoft SQL Server Driver for PHP (sqlsrv)

After this you’ll must unzip the file and copy content which is inside into an extension folder, if you want to be sure about the correct destination I recommend to check phpinfo.php in your browser, for me it was http://127.0.0.1:8080/phpinfo.php In this page you’ll find some interesting info, like the right php.ini (it’s location), and your default extension folder.

Search for “Loaded Configuration File” and “extension_dir”

Copy extracted files from downloaded driver in extension dir

Edit Loaded Configuration File “php.ini” and add this two lines in extension part

extension=php_sqlsrv_56_ts.dll
extension=php_pdo_sqlsrv_56_ts.dll

Save changes and reload your Easyphp Devserver

Now you can refresh phpinfo.php and check if driver is loaded

And finally test you page

 

 

 

 

 

 

 

 

Deixa un comentari

Your email address will not be published. Required fields are marked *