简体   繁体   中英

Connect to MSSQL using php from Mac OS X, “No data received”

I needed to be able to connect to the mssql server at work on my laptop. I followed this tutorial to help me connect : http://lkrms.org/php-with-freetds-on-os-x-mavericks/

When I run the phpinfo(), I see that mssql is perfectly loaded, when I try to connect using the mssql_connect function, I get a "No data received" with this error :

Unable to load the webpage because the server sent no data. Error code: ERR_EMPTY_RESPONSE

I checked the php log, there is absolutely nothing.

I'm using MAMP on Mac OS X Mavericks. I'm 100% sure that I'm using the right server address, port, user, password, everything.

EDIT: I get those errors in my apache log:

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

I recently ran into a similar issue. MAMP tries to append it's own paths to DYLD_LIBRARY_PATH which was causing some confusion with FreeTDS.

Open MAMP/Library/bin/envars and comment out:

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

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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