PHP 7.2 with mcrypt in Windows

Basically I think you have mentioned all possibilities and you do not have a choice. Do not downgrade to PHP 5.6 this approach has no future.

MCrypt was removed from PHP for one of the main reasons why you want to upgrade PHP: Security. The MCrypt library is not maintained anymore. Therefore installing the MCrypt extension is also a bad idea. But it can be a temporary solution (follow e.g. those instructions https://serverpilot.io/community/articles/how-to-install-the-php-mcrypt-extension.html).

The only good solution is migrating from mcrypt to something else. There are questions regarding this topic on Stackoverflow already (e.g. Upgrading my encryption library from Mcrypt to OpenSSL). Alternativly you could use some encryption library. Migrating a large amount of code/data might be a pain but this is the most future-oriented approach in this case.


Despite all the warnings and suggestions if you still need to make it work, try this:

  1. Locate your PHP directory. Usually it is located on C:\Program Files\PHP\v7.2
  2. Then go to this url: http://pecl.php.net/package/mcrypt/1.0.3/windows
  3. Download the package that better meets your requirements. For example if you are using FastCGI and have a 64 bit Windows installation pick 7.2 Non Thread Safe (NTS) x64
  4. Open the zip and copy php_mcrypt.dll file to the C:\Program Files\PHP\v7.2\ext directory.
  5. Edit the php.ini file and add this to the Dynamic extensions section: extension=php_mcrypt.dll
  6. Save php.ini and restart your web server.

Hope it helps.