You need to compile PHP with the --with-mhash parameter to enable this extension.
The mhash functions are provided by the Hash extension, which is always available. The --with-mhash option is deprecated as of PHP 8.1.0 and emits a warning at configure time.