Enabling the sqlsrv extension in PHP

software development

#1

Hi guys,

It’s been a while since I’ve made extensive use of the PHP environment on my DH Shared Server - I normally run fully .Net Framework web apps on my own server, so this is entirely new to me.

I have a software package that requires the use of the sqlsvr extension which I do not know how to install/enable etc…

Has anyone done something similar or know how to achieve this?

Thanks


#2

You should be able to do it with a phprc file. There is documentation here: https://help.dreamhost.com/hc/en-us/articles/214200688


#3

Right, I’ve got the file, I know my site is running under PHP 7.2 (the current recommended option).
I’ve found and edited /home/{user}/.php/7.2/phprc to include the line:
extension=php_sqlsrv_54_nts.dll

I’ve run the killall command, it didn’t return any errors but my site still throws the error:
Fatal error: Uncaught Error: Call to undefined function sqlsrv_query()

Now what?


#4

You’ll also need to install that .dll file. See this page in the PHP Manual:

https://www.php.net/manual/en/sqlsrv.installation.php

I’m not sure if you can do that on shared hosting. It may be time to open a support ticket if there is nothing else in the knowledge base.