{"id":2313,"date":"2018-02-05T18:35:34","date_gmt":"2018-02-05T13:05:34","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=2313"},"modified":"2026-09-20T10:32:04","modified_gmt":"2026-09-20T05:02:04","slug":"install-mcrypt-php-macos-high-sierra-development-server","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/install-mcrypt-php-macos-high-sierra-development-server\/","title":{"rendered":"Install mcrypt for php on macos high sierra for a Development Server"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Post Date: February 5, 2018 <br>Last Updated: September 20, 2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This guide originally explained how to install the <code>mcrypt<\/code> PHP extension on macOS for a development server. Before following it, there&#8217;s something important to know: <code>mcrypt<\/code> was removed from PHP core in PHP 7.2, and the underlying <code>libmcrypt<\/code> library itself has been unmaintained since 2007 and is considered insecure by modern standards.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>macOS with Homebrew installed<\/li>\n\n\n\n<li>PHP installed<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Important: Don&#8217;t Use mcrypt for New Code<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;re writing new code, use PHP&#8217;s built-in <strong>OpenSSL<\/strong> functions instead \u2014 <code>openssl_encrypt()<\/code> and <code>openssl_decrypt()<\/code> are included with PHP by default, actively maintained, and don&#8217;t require installing anything extra. This avoids both problems with the original guide below: <code>mcrypt<\/code> being deprecated\/insecure, and the <code>homebrew\/php<\/code> tap it depended on no longer existing (Homebrew removed that tap years ago, so <code>brew install homebrew\/php\/php71-mcrypt<\/code> will fail on any current system).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Only continue with the steps below if you&#8217;re maintaining genuinely legacy code that hasn&#8217;t been migrated off <code>mcrypt<\/code> yet.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Architecture<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PHP&#8217;s encryption calls are handled by whichever extension is loaded \u2014 either the built-in <strong>OpenSSL<\/strong> extension, or the legacy <strong>mcrypt<\/strong> extension if explicitly installed and enabled<\/li>\n\n\n\n<li><code>php.ini<\/code> determines which extensions PHP loads at startup<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/02\/ChatGPT-Image-Sep-20-2026-10_18_10-AM.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"936\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/02\/ChatGPT-Image-Sep-20-2026-10_18_10-AM-1024x936.png\" alt=\"\" class=\"wp-image-11852\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/02\/ChatGPT-Image-Sep-20-2026-10_18_10-AM-1024x936.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/02\/ChatGPT-Image-Sep-20-2026-10_18_10-AM-300x274.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/02\/ChatGPT-Image-Sep-20-2026-10_18_10-AM-768x702.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/02\/ChatGPT-Image-Sep-20-2026-10_18_10-AM.png 1312w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Steps (Legacy Compatibility Only)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1. Check your PHP version:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php --version\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2. Install mcrypt via PECL<\/strong> (the current path, since the old Homebrew tap is gone):<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">pecl install mcrypt-1.0.6\n<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">This compiles against the deprecated <code>libmcrypt<\/code> library, which you may also need to install separately via Homebrew (<code>brew install mcrypt<\/code>, if still available on your macOS version).<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3. Find the compiled extension file:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">find \/usr -type f -name \"mcrypt.so\"\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>4. Find your php.ini:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php -i | grep 'Configuration File'\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>5. Add the extension to php.ini:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">extension=\/path\/to\/mcrypt.so\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>6. Restart Apache<\/strong> (or PHP-FPM, depending on your setup), then confirm with a <code>phpinfo()<\/code> test page.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The real fix here usually isn&#8217;t installing <code>mcrypt<\/code> \u2014 it&#8217;s migrating the code that still calls <code>mcrypt_encrypt()<\/code>\/<code>mcrypt_decrypt()<\/code> over to PHP&#8217;s built-in <code>openssl_encrypt()<\/code>\/<code>openssl_decrypt()<\/code> functions. Only install <code>mcrypt<\/code> itself if you&#8217;re temporarily supporting legacy code you haven&#8217;t migrated yet, and treat it as a short-term bridge rather than a long-term setup.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Why was mcrypt removed from PHP?<\/strong> The underlying <code>libmcrypt<\/code> library stopped being maintained in 2007, and PHP&#8217;s project decided to remove the extension from core starting in PHP 7.2 rather than keep shipping an unmaintained, insecure component.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Is OpenSSL a drop-in replacement for mcrypt?<\/strong> Not exactly a drop-in \u2014 the function signatures differ, so migrating requires updating your encryption\/decryption code, not just swapping the extension. But it&#8217;s the standard, supported path forward.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Why did brew install homebrew\/php\/php71-mcrypt fail for me?<\/strong> Homebrew removed the entire <code>homebrew\/php<\/code> tap years ago. That specific formula path no longer exists on any current Homebrew installation.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Related Articles<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/managing-multiple-php-versions-on-ubuntu-using-apt\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Install and Manage Multiple PHP Versions on Ubuntu<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Automate Kannel Monitoring with PHP and Scheduled Cron Jobs<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to our experts.<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Looking for the right technology solution for your business? Our team of experts can help you with development, cloud, DevOps, design, and a wide range of other technology needs. Get in touch with our team <a href=\"https:\/\/pheonixsolutions.com\/contact\">here<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Post Date: February 5, 2018 Last Updated: September 20, 2026 Introduction This guide originally explained how to install the mcrypt [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_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":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1021],"tags":[273],"class_list":["post-2313","post","type-post","status-publish","format-standard","hentry","category-mobile-flutter","tag-php","psol-cat-mobile-flutter"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-Bj","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=2313"}],"version-history":[{"count":2,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2313\/revisions"}],"predecessor-version":[{"id":11854,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2313\/revisions\/11854"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}