使用php的MongoDB无法创建会话

I can create a session locally by using mongo shell and remotely by using vscode mongo plugin(Azure Cosmos DB).

But with PHP Mongo driver, it doesn't work:

MongoDB \ Driver \ Exception \ RuntimeException (11002)
Could not generate UUID for logical session id, we need a cryptography library like libcrypto, Common Crypto, or CNG

This error message is reported by php. No errors occurs on monogo.log

  • php version: 7.2.3, mongo version: 4.0.2.
  • both php-fpm and mongod are listening on the same ubuntu server.
  • both php-fpm and mongod has openssl enabled.
  • libcrypto and pkg-config is installed on this server(I don't know php will read it or not).