Philip,
Here is an example of my connection string with the Encrypt and TrustServerCertificate settings. I am connecting to an older SqlServer that doesn't support TLS, so encryption is turned off.
$conn = new PDO('sqlsrv:$url,1433;Database=$db;Encrypt=0;TrustServerCertificate=1', $user, $password);
I also had to modify my /etc/ssl/openssl.cnf and appended this to the end:
[default_conf]
ssl_conf = ssl_sect
[ssl_sect]
system_default = system_default_sect
[system_default_sect]
MinProtocol = TLSv1
CipherString = mailto:DEFAULT@SECLEVEL
https://stackoverflow.com/questions/72201289/cant-do-svn-checkout-because-of-tls-error
I was able to upgrade the ODBC Driver for SqlServer to Version 18.x and to successfully connect on my upgraded Ubuntu 22.04 system.