0

I've developed a web application in php that connects to an azure sql database using sqlsrv_connect(). This is a function from the SQLSRV driver by Microsoft. The application runs great locally (Using the azure database). I can select, insert and delete data perfectly fine.

However, I now want to put the application in my live environment. When I do this I get the following error:

Fatal error: Call to undefined function sqlsrv_connect()

Which is logical because I did not install the SQLSRV extension in my hosting environment. I can find no explanation on how to do this, this leaves me with the question is it even possible to do this? If so can you help me with that, if not what is my alternative?

techraf
  • 64,883
  • 27
  • 193
  • 198
  • you may miss the `sqlsrv_connect()` (i.e) configuration problem. I think you need to install some `dll` files – Karthi Oct 13 '16 at 12:15
  • Yes I know, but can I do this on my website host? And if so, how? – OutOfTheBox Oct 13 '16 at 12:16
  • https://azure.microsoft.com/en-in/documentation/articles/web-sites-php-configure/ – Karthi Oct 13 '16 at 12:20
  • Alright but that is for a webapp in azure, I just want to host it as a page in the hosting environment I'm already paying for to host another website of mine – OutOfTheBox Oct 13 '16 at 12:22
  • i con't get you – Karthi Oct 13 '16 at 12:26
  • Alright, let me clarify. I've built a php web page that connects to an azure sql database. This works fine locally but now that I want to put it online it throws this error. I want to put it online via a web hosting package which I already use for another website. In order to get the sqlsrv-connect function working i indeed need to install the Dll files, but how do I do this in my web hosting package? I can upload files via ftp. But I can't imagine just uploading the Dll file to the public html folder is going to do the trick – OutOfTheBox Oct 13 '16 at 12:30
  • 1.no no no.... you need to contact the service provider to do that(for dll problem, not in public folder its not like that). 2.you have a `db` in azure and files in different host right ? – Karthi Oct 13 '16 at 12:33
  • You are correct one 2. And for 1 I was already afraid of that, I am not sure if they can do that for me. So that is why I asked if there is another way to connect to an azure sql database via my php files instead of using sqlsrv_connect – OutOfTheBox Oct 13 '16 at 12:36
  • this will help to you http://stackoverflow.com/questions/5108031/how-do-i-link-my-godaddy-domain-name-to-windows-azure – Karthi Oct 13 '16 at 12:37
  • once i worked like php with sql db. in godaddy. defaulty its working for me. i never do ant special moves – Karthi Oct 13 '16 at 12:39
  • http://www.codeproject.com/Tips/890336/Set-Your-GoDaddy-Domain-Name-To-Your-Azure-Website – Karthi Oct 13 '16 at 12:42
  • But I do not want to use an azure website, I just want to link to my azure sql database from my own website hosted on another host – OutOfTheBox Oct 13 '16 at 12:44
  • yes you just try with config the database like `hostname` `uname` `pwd`. may give hostname as your link – Karthi Oct 13 '16 at 12:46
  • or, u just use website hosted on sql database – Karthi Oct 13 '16 at 12:47
  • To confirm, are you using Azure Web Apps to host your application? Or some other cloud platforms? And could you confirm what is the system OS using in your server host? Windows or Linux? – Gary Liu Oct 14 '16 at 01:24

2 Answers2

0

You have to install php_sqlsrv_xx_ts.dll ext in your server.

Please follow this link for correct dll file https://msdn.microsoft.com/en-us/library/cc296170(v=sql.105).aspx

Parveen Chauhan
  • 1,396
  • 12
  • 25
0

Most Shared Hosting packages offered on the Internet based on apache do not allow connecting to a MSSQL database because that will require Apache/PHP being re-compiled with the MSSQL extension and also typically the FreeTDS library being installed. On shared hosting environments the extension should be installed as part of the package offered by the hosting or you won't be able to connect to a MSSQL instance. However you can do all these installations on Virtual Private Servers (VPS).

Alberto Morillo
  • 13,893
  • 2
  • 24
  • 30