使用Mac OS X中的PHP连接到MSSQL,"没有收到数据"

时间:2014-07-22 19:30:17

标签: php sql-server macos mamp freetds

我需要能够在我的笔记本电脑上连接到mssql服务器。我按照本教程帮助我连接:http://lkrms.org/php-with-freetds-on-os-x-mavericks/

当我运行phpinfo()时,我看到mssql完全加载,当我尝试使用mssql_connect函数进行连接时,我得到了一个"没有收到数据"有这个错误:

无法加载网页,因为服务器未发送任何数据。错误代码:ERR_EMPTY_RESPONSE

我检查了php日志,绝对没有。

我在Mac OS X Mavericks上使用MAMP。我100%确定我使用的服务器地址,端口,用户,密码等等。

编辑:我在apache日志中收到了这些错误:

dyld: lazy symbol binding failed: Symbol not found: _iconv_open
Referenced from: /usr/local/freetds/lib/libsybdb.5.dylib
Expected in: /Applications/MAMP/Library/lib/libiconv.2.dylib

dyld: Symbol not found: _iconv_open
Referenced from: /usr/local/freetds/lib/libsybdb.5.dylib
Expected in: /Applications/MAMP/Library/lib/libiconv.2.dylib

dyld: lazy symbol binding failed: Symbol not found: _iconv_open
Referenced from: /usr/local/freetds/lib/libsybdb.5.dylib
Expected in: /Applications/MAMP/Library/lib/libiconv.2.dylib

dyld: Symbol not found: _iconv_open
Referenced from: /usr/local/freetds/lib/libsybdb.5.dylib
Expected in: /Applications/MAMP/Library/lib/libiconv.2.dylib

1 个答案:

答案 0 :(得分:1)

我最近遇到了类似的问题。 MAMP尝试将自己的路径附加到DYLD_LIBRARY_PATH,这导致了与FreeTDS的混淆。

打开MAMP / Library / bin / envars并注释掉:

if test "x$DYLD_LIBRARY_PATH" != "x" ; then DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH" else DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib" fi export DYLD_LIBRARY_PATH

祝你好运!