msphpsql
msphpsql copied to clipboard
Get Error PHP 7.4
[linux]
+## Client operating system
ubuntu 16.04
+## PHP version
php 7.4.13
HI.
There are several php versions installed on my server.
According to your instructions in the link below
https://github.com/microsoft/msphpsql/issues/1142
https://tecadmin.net/switch-between-multiple-php-version-on-ubuntu/
I Switch to version 7.4
And I executed the following commands
sudo update-alternatives --set php /usr/bin/php7.4
sudo update-alternatives --set phar /usr/bin/phar7.4
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.4
sudo update-alternatives --set phpize /usr/bin/phpize7.4
sudo update-alternatives --set php-config /usr/bin/php-config7.4
But the following error is still not eliminated
PHP Warning: PHP Startup: Unable to load dynamic library 'sqlsrv.so' (tried: /usr/lib/php/20190902/sqlsrv.so (/usr/lib/php/20190902/sqlsrv.so: undefined symbol: _object_and_properties_init), /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 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: undefined symbol: php_pdo_register_driver), /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: undefined symbol: _object_and_properties_init), /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 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: undefined symbol: call_user_function), /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 'pdo_sqlsrv.so' (tried: /usr/lib/php/20190902/pdo_sqlsrv.so (/usr/lib/php/20190902/pdo_sqlsrv.so: undefined symbol: call_user_function), /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
@yitam
Thank you very much for your help
Hi @darkaleh how did you install our sqlsrv drivers? Which version? Did it work before you switched?
Hi @yitam I installed sqlsrv with the following command sudo pecl install sqlsrv sudo pecl install pdo_sqlsrv And I uninstalledthe sqlsrv driver again and reinstalled it with the following command sudo pecl install sqlsrv-5.8.0 sudo pecl install pdo_sqlsrv-5.8.0
I suppose you did pecl install
after you have switched your php version with update-alternatives
?
Were pecl install successful? Can you find sqlsrv.so or pdo_sqlsrv.so in /usr/lib/php/20190902/
?
Have you followed the instructions?
That is, did you create the sqlsrv.ini or pdo_sqlsrv.ini files in /etc/php/7.4/mods-available
?
Did you run phpenmod -v 7.4
What's the output when you run php-config --phpapi
?
Yes. I did the pecl install command once before changing the php version, but then I deleted sqlsrv again and ran the pecl install command again after changing the version. Yes the pdo_sqlsrv.so file is in the path below. /usr/lib/php/20190902/ Yes I created the pdo_sqlsrv.ini and sqlsrv.ini files
Phpenmod -v 7.4 command output: WARNING: usage: phpenmod [ -v ALL|php_version ] [ -s ALL|sapi_name ] module_name [ module_name_2 ]
php-config --phpapi command output: 20151012 @yitam
I suggest deleting all versions of php and start fresh. This command worked for me before.
# You could change 7.4 to any previous versions installed on your machine
sudo apt-get purge php-pear php-dev php-xml php7.4-common -y --allow-unauthenticated
Close due to inactivity.