Connecting to MS SQL Server via XAMPP PHP undefined function sqlsrv_connect - php

I'm new to PHP (and web servers for that matter).
Here's what I'm dealing with.
Database Server: MS SQL Server 2014 Express
Web Server: XAMPP v3.2.2
PHP: PHP Version 7.3.0
I'm trying to connect to my database via PHP.
Here's what I've done thus far.
1) Since I need drivers for PHP Version 7.3.0, I got them at https://github.com/Microsoft/msphpsql/releases (Windows-7.3.zip)
There are four files in the folder.
2) I've placed all possible combinations of those files in C:\xampp\php\ext and added/deleted corresponding lines like "extension=php_pdo_sqlsrv_73_nts"
I don't know if it matters, but I placed all the lines just under all the other extensions (the last on the list is "extension=shmop").
3) Then I've proceeded to http://localhost/dashboard/phpinfo.php, but there was no changes on this page. And my connection attempt results in the same error:
Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect()
Any help would be appreciated. Thank you!

Related

Connect SQL Server 2012 with PHP version 8.1.1

I have added this 2 lines
extension=php_pdo_sqlsrv_81_ts_x64.dll
extension=php_sqlsrv_81_ts_x64.dll
inside my php.ini file and than I have added this 2 files inside in drivers too. It is not getting connected with SQL Server 2012 and PHP version which I am using is 8.1.6.
Any help will highly appreciated.
Error message:
call to undefined function sqlserv

Call to undefined function mysql_connect() on Heroku. (PHP works fine locally but not on heroku- why?)

Thanks for your help in advance. I have been working on this bug for more than 12 hours now.
There is an AJAX signup form in my Heroku site which runs on MySQL and is connected to ClearDB Database. I can successfully send data to the database on my local server (MAMP). However, I cannot do the same on the server.
The requests cannot get send to the database and gets stuck at loading. Upon inspection I realise it is a PHP 500 Error.
I found the key problem in the Heroku logs. 2014-11-24T15:02:31.238493+00:00 app[web.1]: [24-Nov-2014 15:02:30 UTC] PHP Fatal error: Call to undefined function mysql_connect() in /app/index.php on line 5
Line 5 of the index.php is mysql_connect('hostname', 'username, 'password');
I have tried running php_getinfo(); and found that there is no MySQL support in the server. On a side note, I have MySQL support in my localhost.
The server php.ini paths are as such: Configuration File (php.ini) Path /app/.heroku/php/etc/php & Loaded Configuration File /app/vendor/heroku/heroku-buildpack-php/conf/php/php.ini
What should I do?
mysql_* functions are deprecated and actually removed in the next PHP version. Check out mysqli.
Worth noting that you can enable mysql_* on Heroku via composer.json. This is documented in Heroku's devcenter docs on PHP support.
Also recommend you consider using a more modern MySQL library, though :)

Using PHP 5.4 and Freetds

I keep getting the following message when trying to connect to a ms sql database via PHP
Fatal error: Call to undefined function mssql_connect()
I need to do it using FREETDS, I have followed the instructions: http://docs.moodle.org/24/en/Installing_MSSQL_for_PHP
I am using WAMP with php 5.4 the extension is ticked in my extension list in wamp toolbar. One thing I wonder is whether it's something to do with freetds.conf under a standard wamp install where should this go? I have it sitting in the root of c and under bin/php/php5.4.16. The only info I have changed in it is the IP address of the server I want to connect to, is this correct?

How to access remote SQL Server from PHP script [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
PHP Fatal error: Call to undefined function mssql_connect()
I am developing a light-weight PHP application which accesses a remote SQL server db.
So far, I am out of luck in getting connection setup to SQL Server db through my PHP script.
I keep getting this error when I am trying to connect to sql DB:
Fatal error: Call to undefined function mssql_connect()
I get similar error when I try sqlsrv_connect($myServer, $myUser, $myPass) too
Here is what I have already tried:
I search for solution on web for hours, but nothing works.
I downloaded drivers from http://www.microsoft.com/en-us/download/details.aspx?id=20098
and unzipped them into php/ext folder
modified php.ini to add newly downloaded drivers lines:
extension=php_sqlsrv_54_ts.dll
extension=php_pdo_sqlsrv_54_ts.dll
[sqlsrv]
sqlsrv.LogSubsystems = 1
sqlsrv.LogSeverity = 1
sqlsrv.WarningReturnAsErrors = 0
Restarted the Apache server
But, see phpinfo() output it doesn't have sqlserv in it http://bit.ly/TkMC6V
Just so you know, I am developing this on my windows machine by installing EasyPHP. This website will be deployed on a Unix box. I tried to connect sql server through php on both Windows and Unix machine without any success.
Version info:
SQL Server 9.0.5000
PHP ver 5.4.6
Apache 2.4
I just dont get sqlsrv in my phpinfo() as mentioned in this question PHP Fatal error: Call to undefined function mssql_connect()
Is there a different way to install the drivers, other than what I have outlined above?
Let me know if you need more info.
Thanks!
I found the issue, by looking at phpInfo() output carefully
Loaded Configuration File C:\Program Files (x86)\EasyPHP-12.1\apache\php.ini
I was modifying php.ini in php directory.
But, I needed to modify the one in apache directory
I can delete this silly question.
But, I think it might be helpful for someone facing similar issue.
Jeez , I spent 4 hour on this stupid issue. :)

Connecting to MSSQL-Server 2008 under Zend server

Hi I'm currently trying to connect to MSSQL-Server-2008 using php on a Zend (web) server.
I've tried out a few things now but always end up getting:
PHP Warning: PHP Startup: Unable to load dynamic library 'E:\Zend\ZendServer\lib\phpext\php_pdo_sqlsrv_53_ts_vc9.dll' - The required module was not found
(sry if the error message sounds a bit strange I translated it manually into english)
First step I did was to download:
Microsoft SQL Server 2008 R2 Native Client
2nd step was that I downloaded:
SQLSRV20.EXE and extracted the files into the phpext directory.
3rd step was that I tried to turn on:
pdo_sqlsrv_53_nts_vc9
and / or
pdo_sqlsrv_53_ts_vc9
And restarted php.
Regardless of what I did I received the above error message.
Thus every time I try to connect to the mssql server I get an error message:
*PHP Fatal error: Call to undefined function sqlsrv_connect()*
Are there any additional steps needed?
(PHP Version I use is: 5.3.9 with a very new version of the zend server).
thanks
In the Zend server itself there are SQL drivers install them along it with general installation.Once the installation is done turn on these extensions sqlsrv,pdo_sqlsrv in the php console.I don't know the exact reason but those extensions which come with SQLSRV20.EXE are not compatible and those cannot be loaded.
Regards,
Sri

Categories