PHP 7.2 Gotcha: mcrypt

Unrelated picture but I thought it was funny since Pulau Ubin is just a small island in Singapore which can only be reached via boats.

PHP 7.2 introduces new features and remove several things. One of the things that caught me off guard was the library ‘mcrypt’.

I was updating one of my PHP Docker images to use PHP 7.2 and noticed that the build has failed. After taking a look at the error message and searching around, I discovered that in PHP 7.2, mcrypt is no longer included as part of PHP extensions. To resolve this, I have to install it via pecl.

Previously, I installed mcrypt via the following command.

docker-php-ext-install mcrypt

To resolve this, I used this new command.

pecl install mcrypt-1.0.1 && docker-php-ext-enable mcrypt

Another gotcha here was that the version had to be specified as mcrypt was not under the ‘stable’ release in pecl. Therefore, the version must be explicitly stated.

Hope this has helped you if you encountered this “gotcha” in PHP 7.2! Feel free to ask any questions below!

Author: Woo Huiren

Currently a student at National University of Singapore. I contribute to opensource projects - primarily PHP and Angular related. I write about PCF and PWS related stuff too.

One thought on “PHP 7.2 Gotcha: mcrypt”

  1. I am the author of the mcrypt extension, and I implore you not to use it any more at all. The library that it wraps around is outdated, and unmaintained. This is not what you want for a security extension.

Leave a Reply