简体   繁体   English

致命错误:在Mac中使用pdo_sqlsrv for PHP使用pdo_sqlsrv_db_handle_factory。 该怎么办?

[英]Fatal error: pdo_sqlsrv_db_handle_factory using pdo_sqlsrv for PHP in Mac. What to do?

Installing PDO_sqlsrv in my macs have really been an hassle. 在我的Mac中安装PDO_sqlsrv确实很麻烦。

I always follow the instructions stated in https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-2017#installing-the-drivers-on-macos-el-capitan-sierra-and-high-sierra 我始终遵循https://docs.microsoft.com/zh-cn/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-2017#installing-the-drivers-on中所述的说明-macos-EL-匹-Sierra公司和高-Sierra公司

yet while sometimes everything works well others it's an hassle. 然而,尽管有时候其他所有东西都运转良好,但这是一个麻烦。

This one I never found before and would like to check if someone came up with it too and if they found any solution? 我以前从未找到过这个,想检查是否有人也提出来了,是否找到了解决方案?

I'm using PHP@7.1 for HomeBrew and High Sierra 我正在将PHP@7.1用于HomeBrew和High Sierra

I managed to solve the issue in the strangest way. 我设法以最奇怪的方式解决了这个问题。

Based on what was proposed here for Ubuntu: https://github.com/Microsoft/msphpsql/issues/161#issuecomment-254046975 基于此处针对Ubuntu提出的建议: https : //github.com/Microsoft/msphpsql/issues/161#issuecomment-254046975

I set the locale in the PHP as: 我在PHP中将语言环境设置为:

setlocale(LC_ALL, 'en_US.UTF-8'); setlocale(LC_ALL,'en_US.UTF-8');

And it magically worked. 它神奇地工作。 I'll probably just go and set the default in PHP.ini to this locale and everything should be ok. 我可能只是去将PHP.ini中的默认值设置为此语言环境,一切就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM