I hit this same issue recently.
debian OS, php 7.1 on command line and in apache; same modules enabled; same configuration; can't see any differences between phpinfo() via apache and php -i on command line.
in apache, no errors. When I try to run drush I get the error reported above.
My temp fix is that since I also have php 7.2 installed on the server ...