msphpsql: symbol not found in flat namespace '_SQLAllocHandle'

Please check the FAQ (frequently-asked questions) first. If you have other questions or something to report, please address the following (skipping questions might delay our responses):

PHP version

PHP 8.0.19 (cli) (built: May 13 2022 09:49:28) ( NTS )

PHP SQLSRV or PDO_SQLSRV version
sqlsrv-5.11.0 pdo_sqlsrv-5.11.0

Microsoft ODBC Driver version

unixODBC 2.3.12 DRIVERS…: /opt/homebrew/etc/odbcinst.ini SYSTEM DATA SOURCES: /opt/homebrew/etc/odbc.ini FILE DATA SOURCES…: /opt/homebrew/etc/ODBCDataSources USER DATA SOURCES…: /Users/gilangpratama/.odbc.ini SQLULEN Size…: 8 SQLLEN Size…: 8 SQLSETPOSIROW Size.: 8

SQL Server version

I’m installed using docker with latest version

Client operating system

macOS Ventura 13.3.1

Problem description

I followed the doc instruction for mac until this section

sudo CXXFLAGS="-I/opt/homebrew/opt/unixodbc/include/" LDFLAGS="-L/opt/homebrew/lib/" pecl install sqlsrv
sudo CXXFLAGS="-I/opt/homebrew/opt/unixodbc/include/" LDFLAGS="-L/opt/homebrew/lib/" pecl install pdo_sqlsrv

the output is like this

Build process completed successfully
Installing '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20200930/pdo_sqlsrv.so'
install ok: channel://pecl.php.net/pdo_sqlsrv-5.11.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=pdo_sqlsrv.so" to php.ini

I think that is a success install. but when I write this code in php.ini:

extension=sqlsrv.so
extension=pdo_sqlsrv.so

The php extension is not installed on my php -m and it show me warning like this

PHP Warning:  PHP Startup: Unable to load dynamic library 'sqlsrv.so' (tried: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20200930/sqlsrv.so (dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20200930/sqlsrv.so, 0x0009): symbol not found in flat namespace '_SQLAllocHandle'), /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20200930/sqlsrv.so.so (dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20200930/sqlsrv.so.so, 0x0009): tried: '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20200930/sqlsrv.so.so' (no such file), '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20200930/sqlsrv.so.so' (no such file), '/sqlsrv.so.so' (no such file), '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20200930/sqlsrv.so.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20200930/sqlsrv.so.so' (no such file), '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20200930/sqlsrv.so.so' (no such file))) in Unknown on line 0

Please, help me, I’ve tried to re-install or rename the extension from extension=sqlsrv.so tobe extension=sqlsrv and it still not working.

About this issue

  • Original URL
  • State: open
  • Created 10 months ago
  • Comments: 26 (11 by maintainers)

Most upvoted comments

I’ll have to look into it, I’m not too familiar with how pecl works, but it looks like it grabbed wrong .so files