{"id":705,"date":"2018-05-29T18:01:04","date_gmt":"2018-05-29T10:01:04","guid":{"rendered":"https:\/\/woohuiren.me\/blog\/?p=705"},"modified":"2018-05-29T18:25:34","modified_gmt":"2018-05-29T10:25:34","slug":"php-7-2-gotcha-mcrypt","status":"publish","type":"post","link":"https:\/\/woohuiren.me\/blog\/php-7-2-gotcha-mcrypt\/","title":{"rendered":"PHP 7.2 Gotcha: mcrypt"},"content":{"rendered":"<p><span style=\"color: #808080;\"><em>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.<br \/>\n<\/em><\/span><\/p>\n<p>PHP 7.2 introduces new features and remove several things. One of the things that caught me off guard was the library &#8216;mcrypt&#8217;.<\/p>\n<p>I was updating one of my <a href=\"https:\/\/github.com\/GIANTCRAB\/php-laravel-env\">PHP Docker images<\/a> 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.<\/p>\n<p>Previously, I installed mcrypt via the following command.<\/p>\n<pre><span class=\"blob-code-inner\">docker-php-ext-install <span class=\"x x-first x-last\">mcrypt<\/span><\/span><\/pre>\n<p>To resolve this, I used this new command.<\/p>\n<pre><span class=\"blob-code-inner\">pecl install <span class=\"x x-first x-last\">mcrypt-1.0.1 &amp;&amp; docker-php-ext-enable mcrypt<\/span><\/span><\/pre>\n<p>Another gotcha here was that the version had to be specified as mcrypt was not under the &#8216;stable&#8217; release in pecl. Therefore, the version must be explicitly stated.<\/p>\n<p>Hope this has helped you if you encountered this &#8220;gotcha&#8221; in PHP 7.2! Feel free to ask any questions below!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8216;mcrypt&#8217;. I was updating one of my PHP Docker &hellip; <a href=\"https:\/\/woohuiren.me\/blog\/php-7-2-gotcha-mcrypt\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;PHP 7.2 Gotcha: mcrypt&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":706,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"PHP 7.2 Gotcha: mcrypt","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[2,5],"tags":[139,171,172,30,170],"class_list":["post-705","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-information-technology","category-programming","tag-docker","tag-mcrypt","tag-pecl","tag-php","tag-php-7-2"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/woohuiren.me\/blog\/wp-content\/uploads\/2018\/05\/20160920_110921-e1527587913315.jpg?fit=1688%2C3000&ssl=1","_links":{"self":[{"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/posts\/705"}],"collection":[{"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/comments?post=705"}],"version-history":[{"count":5,"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/posts\/705\/revisions"}],"predecessor-version":[{"id":711,"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/posts\/705\/revisions\/711"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/media\/706"}],"wp:attachment":[{"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/media?parent=705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/categories?post=705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/tags?post=705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}