Posted by: dm25306 (---.neo.res.rr.com)
Date: July 24, 2020 05:01AM

Hello everyone, I recently upgraded to PHP 7.4.8 / Apache 2.4.43a. After I downloaded & installed all the binaries (VC_redist.x86.exe & VC_redist.x64.exe), updated both the php.ini & phpForApache.ini to reflect the new Microsoft SQL server drivers for version 7.4.8, and restarted WAMP several times, I continue to get the error "Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in C:\wamp64\www\db.php on line 5". Would anyone have an idea as to what may be happening? I can still run my website with the old version of PHP 7.2.18 but I'd like to have the upgraded version up and running.

Any help is appreciated. THANKS! Dave

Options: ReplyQuote
Re: sqlsrv_connect()
Posted by: Otomatic (Moderator)
Date: July 24, 2020 12:34PM


If PHP says "Call to undefined function sqlsrv_connect()", then the function sqlsrv_connect does not exist for the version of PHP you are using, in this case PHP 7.4.8.
If it works with PHP 7.2.18, it means that you are loading the wrong drivers for PHP 7.4.8. Indeed, if you change the PHP version, it's not enough to modify the php.ini and phpForApache.ini files, you also need to put the right version of the driver.
Voir [docs.microsoft.com]

> C:\wamp64\www\db.php
The wamp64\www\ folder is strictly for the Wampserver home page. Your local sites must not install anything there. You must use other folders, for example wamp64\www\myfolder\ or anywhere using VirtualHosts, as with all hosts.

Wampserver 3.2.4 32 bit - Apache 2.4.46a - PHP 7.4.12…5.6.40 - MySQL 5.7.31 - MariaDB 10.5.8
Wampserver 3.2.4 64 bit - Apache 2.4.46a - PHP 7.4.12…5.6.40 - MySQL 5.7.31/8.0.21 - MariaDB 10.5.8
PhPMyadmin 5.0.4 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote
Re: sqlsrv_connect()
Posted by: dm25306 (---.neo.res.rr.com)
Date: July 24, 2020 05:17PM

Hello again! Thanks for letting me know, I will create a subfolder for local sites.

I downloaded all the drivers for 7.4.8 and put them in the ext folder for that version of php and it still gave me that error. However, I loaded PHP version 7.3.5 and put the drivers in the ext folder for that version of php and it worked. I ran phpinfo and the pdo_sqlsrv showed up too. I can use PHP 7.3 for now, perhaps maybe Microsoft needs to update their drivers for 7.4. Thank you again for helping! Have a great day! Dave

Options: ReplyQuote

Sorry, only registered users may post in this forum.