PHP connecting to SQL Server

Error: Server Response: could not find driver
Where should the driver be located?
Does Wappler support the connection to SQL Server using PHP?
I have no issues connecting when using ASP.NET.
image

Hi Dave,
The Database Connector uses PHP PDO to make connections. So on the web server where you run your site, you should make sure PDO is enabled and also the right PDO drivers are installed.

So for connecting to MSSQL Server you should just install the PDO MSSQL Driver to make it work.
See www.php.net/manual/en/ref.pdo-sqlsrv.php

1 Like

Hi - I am getting the exact same problem as this - I installed the drivers from the link, and enabled them - but still the same message?

Any ideas ?
Thanks in advance…

Hi,
There seems to be a lack of information on this subject - ie: setting it up in a test environment linking to MS SQL - and then transferring it to a webserver or keeoing it local as in an intranet…

The main reason I moved from dreamweaver to wappler was the SQL connection - but it seems a bit difficult and most of your examples are for MySql…

Hello @stevenmcgough

What exactly do you mean? If your server is properly configured (which does not really depend on us or our software) it works perfectly fine.

If your server is missing a driver - the connection to this database won’t work.
Our examples are just “examples” - you can replace mysql with ANY database type and it will function the same way, there is no difference.
Also - i already provided a link to a page where you can find information about the driver needed for a PHP server to connect to MSSQL db.
If you are 100% sure installed it and it still doesn’t work then there is some other issue.


Additional Info needed:
  • Is PDO enabled on the server?
  • Which version of PHP is your server running?

Hi,
Sorry if I seemed a bit rude…
My situation is that I need to build web sites / intranet site which will work with the SQL database from our MIS system. These need to be built / tested and ran locally on our network. I have WAMP installed for testing and it works for other PHP / MySql applications. It will migrate to a windows server with ISS after completion. I have installed the driver from your linked page and put it into the PHP extensions on WAMP. a lot of pdo options now show up but they have a red warning sign above them. I have enabled them in php.ini - I assume that this enables these? I am running PHP V 7.0.4

In Wamp settings you can see what is enabled:

Is your server accessible from the outside, i.e. can you provide an external link to it for me?

I don’t see anywhere on your screenshots anything related to PDO_SQLSRV driver I linked to in my previous messages.

You asked:

Is PDO enabled on the server?

Yes it is as you can see it is the same as in the screenshot of your own

Which version of PHP is your server running?

You can see on the second the server config including PHP version

I reinstalled the latest version of WAMP but still the same error.
I also did download again the PDO_SQLSRV you linked to and placed the files in the extension folder of PHP 7.2.14

It’s not enough to just copy the driver to the extensions folder.
Taken from Microsoft docs:

Loading the Driver at PHP Startup

To load the SQLSRV driver when PHP is started, first move a driver file into your extension directory. Then, follow these steps:

  1. To enable the SQLSRV driver, modify php.ini by adding the following line to the extension section, changing the filename as appropriate:
extension=php_sqlsrv_72_ts.dll

Then it will appear in the extensions menu (where it’s currently missing on your screenshot).

I have done that and restarted all services - where is it in your screenshot of extensions…

Sorry - i dont mean to be a pain…

There are quite a few articles and youtube videos about this when you ask google

https://www.google.nl/search?client=safari&hl=nl-nl&ei=sQBBXJmUIcyx0gXFp4KgBA&q=install+pdo+ms+sql+driver+in+wamp+for+windows&oq=install+pdo+ms+sql+driver+in+wamp+for+windows

I am not using an mssql db with my local server, so i don’t have the driver installed. That’s why it’s missing from my screenshots.

I’d suggest following George’s advice and check some nice tutorial/youtube video about doing this in WAMP, or just get someone to set up your server properly if you have no experience in doing this.

I hope you understand that this issue is not really related to Wappler, that is how PHP works - it requires a driver to connect to a mssql db. And the error you see in Wappler is just the error your server returns. Unfortunately there is nothing we can do if you are trying to use Wappler in an environment which is not properly configured.

Hi,
While I appreciate both yours and George’s comments on this. I think I have done everything that is required in configuring the server. I have checked the videos and everything seems to be in order. But I still get the same errors within wappler. I will post some screenshots …
I have chosen PHP Version 7.1.26 from Wamp and downloaded the driver. I have placed both php_pdo_sqlsrv_71_ts_x64.dll and php_pdo_sqlsrv_71_nts_x64 into the [bin][php][php7.1.26][ext] folder and edited the php.ini file accordingly. On “localhost” I can see that “pdo_sqlsrv” is a loaded extension after restarting the services.

I think that is all that should be done. I am not trying to be awkward here - I am sorry - but it still gives me the same error of missing driver in Wappler. I think I am using it in the correct environment…

01

02

Probably you are missing the ODBC driver …
https://www.microsoft.com/en-us/download/details.aspx?id=56567

I don’t think I was missing that - but I have re-downloaded it and ran it anyways. No change I am afraid - still errors… :frowning:

Surlely - someone else has encountered this issue.?
Like I say - I am sorry to be a pain and I really do appreciate your answers…

Steve