Wednesday, August 31, 2022

[SOLVED] How To Connect PHP7.3, sql server & Nginx Debian10

Issue

Please help me....

I've created a web server using OS Debian 10, Nginx and PHP7.3 and everything is running well. but when it will connect to the sql server, it cannot connect.

I've done several tutorials such as:

  1. pecl install sqlsrv pdo_sqlsrv

  2. Follow steps mentioned on https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15

  3. File .ini driver root@debian:~# ls /etc/php/7.3/fpm/conf.d/*sqlsrv.ini /etc/php/7.3/fpm/conf.d/20-sqlsrv.ini /etc/php/7.3/fpm/conf.d/30-pdo_sqlsrv.ini root@debian:~#

  4. my php info: phpinfo

  5. my script and result in browser like : script connect

so please help me to solve this problem, Thank you Very Much


Solution

If you are having issues with the client on Debian 10 with OpenSSL1.1.1 the fix is to revert to the previously default weaker key length. To do so:

Modify

/etc/ssl/openssl.cnf 

config file as follows

Change the last line from

CipherString = DEFAULT@SECLEVEL=2 

to

CipherString = DEFAULT@SECLEVEL=1

(fyi see known issues with OpenSSL 1.1.1 in Debian 10 below):

https://github.com/microsoft/msphpsql/issues/1021

https://wiki.debian.org/ContinuousIntegration/TriagingTips/openssl-1.1.1



Answered By - emadelbieh
Answer Checked By - Terry (WPSolving Volunteer)