Can't load SQLsrv due to "zval_ptr_dtor" error

I had a similar error with a different plugin and this was my solution. When installing an .so addon with pecl, I noticed an error at the end:

configuration option "php_ini" is not set to php.ini location

To fix that I just typed this (for mine I have php version 8) and now it works:

pear config-set php_ini /etc/php/8.0/apache2/php.ini