msphpsql: PHP 7.2 Unable to load dynamic library - undefined symbol: call_user_function
I am having problems setting up the driver on PHP 7.2. The same procedure (as described in the repro section) was used to set it up on 7.1, which I still use on the same server, which has Plesk and multiple PHP versions installed (although note the below has nothing to do with Plesk).
Driver version or file name
Release Version 5.2.0 (stable)
Client operating system
Ubuntu 16.04.4 LTS
PHP version
7.2
Microsoft ODBC Driver version
Package: msodbcsql17 Version: 17.1.0.1-1
Problem description
The module cannot be loaded, with error:
PHP Warning: PHP Startup: Unable to load dynamic library 'sqlsrv.so' (tried: /opt/plesk/php/7.2/lib/php/modules/sqlsrv.so (/opt/plesk/php/7.2/lib/php/modules/sqlsrv.so: undefined symbol: call_user_function), /opt/plesk/php/7.2/lib/php/modules/sqlsrv.so.so (/opt/plesk/php/7.2/lib/php/modules/sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Repro code
/opt/plesk/php/7.2/bin/pecl install sqlsrv- Find the compiled extension:
find / -name 'sqlsrv.so' - Copy compiled extension to correct dir:
cp /usr/lib/php/20151012/sqlsrv.so /opt/plesk/php/7.2/lib/php/modules/ - Create .ini (with 75- prefix, so it’s loaded last)
echo "extension=sqlsrv.so" > /opt/plesk/php/7.2/etc/php.d/75-sqlsrv.ini - Try running a php command, e.g.:
root@ocelot:~# /opt/plesk/php/7.2/bin/php -v
PHP Warning: PHP Startup: Unable to load dynamic library 'sqlsrv.so' (tried: /opt/plesk/php/7.2/lib/php/modules/sqlsrv.so (/opt/plesk/php/7.2/lib/php/modules/sqlsrv.so: undefined symbol: call_user_function), /opt/plesk/php/7.2/lib/php/modules/sqlsrv.so.so (/opt/plesk/php/7.2/lib/php/modules/sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.2.5 (cli) (built: Apr 27 2018 10:11:23) ( NTS )
Copyright (c) 1997-2018 The PHP Group
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (6 by maintainers)
Ok, got it. By looking at the output, I realised it’s not using the correct API, like you mentioned before.
However:
The solution was to install plesk-php72-dev and fix the PECL config, like described here. After reinstalling it already copies it in the correct modules dir. So yes, it’s was probably just a multi-php Plesk specific issue (don’t know if the OS provided one installs the dev package). Thank you for helping out 😃
Thank you that sovled it!! I added extension=pdo.so just above the extension=pdo_sqlsrv.so and it worked!
I also removed all the odbc mssq-tools, some freetds and freetds-dev stuff i had and then reinstalled mssql-tools, unixodbc, unixodbc-dev and msodbcsql17
Solved a similar problem as follows:
And also put the package
apt-get install php7.2-devOtherwise, an error occurredsh: 1: phpize7.2: not found ERROR: phpize failedFind and put this package failed
–