Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The packages sqlsrv and pdo_sqlsrv version 5.10.0 do not work for PHP 8.0 on Debian 11 #1377

Closed
drupal-daffie opened this issue Feb 28, 2022 · 8 comments

Comments

@drupal-daffie
Copy link

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 8.0

PHP SQLSRV or PDO_SQLSRV version 5.10.0

Microsoft ODBC Driver version 18

SQL Server version Not important

Client operating system Debian 11

Table schema Not important

Problem description
I have changed the default PHP version from 8.1 to 8.0. When I run php -v it returns to me that I am running version 8.0.
I then install the packages sqlsrv and pdo_sqlsrv, like:

sudo pecl channel-update pecl.php.net
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
sudo su
printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/8.0/mods-available/sqlsrv.ini
printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/8.0/mods-available/pdo_sqlsrv.ini
exit
sudo phpenmod -v 8.0 sqlsrv pdo_sqlsrv

When I than run php -v I get the following warning:

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_sqlsrv.so' (tried: /usr/lib/php/20200930/pdo_sqlsrv.so (/usr/lib/php/20200930/pdo_sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20200930/pdo_sqlsrv.so.so (/usr/lib/php/20200930/pdo_sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlsrv.so' (tried: /usr/lib/php/20200930/pdo_sqlsrv.so (/usr/lib/php/20200930/pdo_sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20200930/pdo_sqlsrv.so.so (/usr/lib/php/20200930/pdo_sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'sqlsrv.so' (tried: /usr/lib/php/20200930/sqlsrv.so (/usr/lib/php/20200930/sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20200930/sqlsrv.so.so (/usr/lib/php/20200930/sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'sqlsrv.so' (tried: /usr/lib/php/20200930/sqlsrv.so (/usr/lib/php/20200930/sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20200930/sqlsrv.so.so (/usr/lib/php/20200930/sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 8.0.13 (cli) (built: Nov 22 2021 09:47:37) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.13, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.13, Copyright (c), by Zend Technologies

Installing it for PHP 8.1 works great. Thank you for that.

Expected behavior and actual behavior
Make it compile for PHP 8.0 and PHP 7.4

Repro code or steps to reproduce
See Problem description and I am using PHP from https://deb.sury.org/ with multiple versions of PHP.

@rfay
Copy link

rfay commented Feb 28, 2022

Do they work on php7.4?

@drupal-daffie
Copy link
Author

It fails with PHP 7.4 with the following result:

daffie@ddev-93mssql-web:/var/www/html/web$ php -v
PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_sqlsrv.so' (tried: /usr/lib/php/20190902/pdo_sqlsrv.so (/usr/lib/php/20190902/pdo_sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/pdo_sqlsrv.so.so (/usr/lib/php/20190902/pdo_sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlsrv.so' (tried: /usr/lib/php/20190902/pdo_sqlsrv.so (/usr/lib/php/20190902/pdo_sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/pdo_sqlsrv.so.so (/usr/lib/php/20190902/pdo_sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'sqlsrv.so' (tried: /usr/lib/php/20190902/sqlsrv.so (/usr/lib/php/20190902/sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/sqlsrv.so.so (/usr/lib/php/20190902/sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'sqlsrv.so' (tried: /usr/lib/php/20190902/sqlsrv.so (/usr/lib/php/20190902/sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/sqlsrv.so.so (/usr/lib/php/20190902/sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.4.26 (cli) (built: Nov 22 2021 09:49:28) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.26, Copyright (c), by Zend Technologies

@rfay
Copy link

rfay commented Feb 28, 2022

@drupal-daffie
Copy link
Author

I followed the instructions and I got the fail.

@absci
Copy link
Contributor

absci commented Mar 2, 2022

I can confirm this issue. A work around is after change version to 8.0 do pecl uninstall sqlsrv pdo_sqlsrv and then pecl install sqlsrv pdo_sqlsrv. We'll look into the possibilities of having pecl compile for different PHP versions.

@drupal-daffie
Copy link
Author

@absci: Thank you!

@absci
Copy link
Contributor

absci commented May 3, 2022

I did some research and I think it's not possible to let Pecl compile for all php versions during one install. But I found a solution here. I have both 8.0 and 8.1 installed on my machine.

sudo pecl -d php_suffix=8.1 install sqlsrv
sudo pecl uninstall -r sqlsrv
sudo pecl -d php_suffix=8.0 install sqlsrv
sudo pecl uninstall -r sqlsrv

After that both php versions can use sqlsrv extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants