microsoft / msphpsql

Microsoft Drivers for PHP for SQL Server
MIT License
1.8k stars 374 forks source link

在MAC上使用PHP连接sqlserver报错 #1378

Closed ttdms closed 2 years ago

ttdms commented 2 years ago

PHP version 8.1.3

PHP SQLSRV or PDO_SQLSRV version 5.10

Microsoft ODBC Driver version ODBC 18

SQL Server version 2019

Client operating system MacOS 12

我在mac上面搭建了PHP环境,并且确认可以运行,尝试使用php连接sql服务器,却报错了。 image 然后我又用了dsn连接,还是报错 image

在windows下用php连接没有问题,代码是一致的。

PHP框架使用的是ThinkPHP 6

absci commented 2 years ago

certificate verify failed usually caused by install ODBC from an untrusted source, recommend uninstall ODBC then follow this instruction to install again. If you don't need encryption, you could also try adding encrypt=no to your connection string and it should silence this error.

certificate verify failed通常是未从信任的源头安装ODBC造成的,建议卸载ODBC,之后跟随安装指示重新安装。如果不需要加密,你也可以尝试在连接字串中加入encrypt=no,这应该可以避开这个错误。

ttdms commented 2 years ago

certificate verify failed usually caused by install ODBC from an untrusted source, recommend uninstall ODBC then follow this instruction to install again. If you don't need encryption, you could also try adding encrypt=no to your connection string and it should silence this error.

certificate verify failed通常是未从信任的源头安装ODBC造成的,建议卸载ODBC,之后跟随安装指示重新安装。如果不需要加密,你也可以尝试在连接字串中加入encrypt=no,这应该可以避开这个错误。

我尝试重新安装ODBC,还是这个情况,这个问题已经折磨了我一个月了