sqlsrv_connect returns false on Ubuntu with no connection data changes

36 views Asked by At

I have a web project that run Symfony as a backend with php 8.3 On my laptop when I run the project and use the php sqlsrv driver to call sqlsrv_connect() and pass in my connection details it works flawlessly. This is a Windows 10 machine. When I move the project over to my prod Ubuntu server, ensure and triple check all my dependencies and see for a fact with php -m and by echoing phpinfo() that sqlsrv and pdo_sqlsrv are installed and recognized by PHP, and then I use the exact some code to call sqlsrv_connect() I get a return of "false". Nothing else is different. The OS and drivers are compiled for the OS and that OS's PHP version obviously but other than that there is no difference. Both machines are on the exact same network, both machines can ping the DB host, both machines are whitelisted, a Ubuntu machine has made a successful connection to this same DB before but the php and driver versions are much older. The only error I get in my logs is from symfony telling me that it can't do anything with "false" as it needs a resource but a bool was returned when I pass the result into my next function call. Any ideas? I've asked everyone I know and ChatGPT as well as researched this for hours before writing here.

Tried the following

Reinstalled Apache, PHP, and all drivers Reinstalled OS Triple-checked my connection string Tried specifying the port ( even though we haven't needed to before ) Checked all firewall settings Checked with the DB host that a connection is being attempted Ensured all requirements were met ran and re-ran my composer install cleared all caches checked all whitelists searched for an answer for hours

0

There are 0 answers