{"id":2648,"date":"2024-12-31T20:25:46","date_gmt":"2024-12-31T20:25:46","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/solved-error-in-compat-php-while-installing-magento-2\/"},"modified":"2025-01-02T10:00:00","modified_gmt":"2025-01-02T10:00:00","slug":"error-in-compat-php-while-installing-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/error-in-compat-php-while-installing-magento-2\/","title":{"rendered":"Solved: Error in Compat.php While Installing Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello Magento Peeps,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Stumbled upon an unexpected <em><strong>error in compact.php while installing Magento 2<\/strong><\/em>?  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We&#8217;ve got you covered, probably!  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Recently, I <a title=\"Install Magento 2\" href=\"https:\/\/meetanshi.com\/blog\/install-magento-2\/\" target=\"_blank\" rel=\"noopener\">installed Magento 2<\/a> with XAMPP on a Windows PC of one of my colleagues and encountered an unexpected error. The error read:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>In compat.php line 1927:<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>This is not implemented, as it is not possible to implement Argon2i with acceptable performance in pure-PHP.<\/code><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2022\/12\/In-Compat.php-line-1927-error-during-Magento-2-installation.png\" alt=\"In Compat.php line 1927 error while installing Magento 2\" class=\"wp-image-28193\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">On further investigation, I found that the error was thrown by Magento because certain <a title=\"PHP extensions\" href=\"https:\/\/www.php.net\/manual\/en\/extensions.php\" target=\"_blank\" rel=\"noopener\">PHP extensions<\/a> were missing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you are also facing such an error while installing Magento 2, you can follow this blog post to solve the issue.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Solve Error in Compat.php During Magento 2 Installation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 is a PHP-based eCommerce platform and requires certain resources to function properly. You can check out <a title=\"Magento 2 system requirements\" href=\"https:\/\/meetanshi.com\/blog\/magento-2-system-requirements\/\" target=\"_blank\" rel=\"noopener\">Magento 2 system requirements<\/a> for your reference.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Coming back to the issue, the &#8220;This is not implemented, as it is not possible to implement Argon2i with acceptable performance in pure-PHP.&#8221; during Magento installation is caused because of the missing PHP extension named <code>sodium<\/code>. The solution is to enable sodium extension.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Detailed steps to solve the issue in a Local XAMPP server are provided below:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 1:&nbsp;<\/strong>Open the XAMPP control panel, and go to <strong>Configure &gt; PHP&nbsp;<\/strong>in the Apache module.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2022\/12\/Error-in-Compat.php-while-Installing-Magento-2-Xampp-e1671601744342.png\" alt=\"Error in Compat.php While Installing Magento 2 - XAMPP\" class=\"wp-image-28344\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 2:&nbsp;<\/strong>This will open the <code>php.ini<\/code> file, where you can find the list of active\/inactive PHP extensions. Find <code>extension=sodium<\/code>, remove the <code>;<\/code> sign before it, and save the file. This will enable <code>sodium<\/code> extension.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2022\/12\/Enable-Sodium-Extension-in-PHP-to-Solve-Compat.php-Error.png\" alt=\"Enable Sodium Extension PHP to Solve Compat.php Error While Installing Magento 2\" class=\"wp-image-28345\"\/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 3:&nbsp;<\/strong>Restart the web server, and you&#8217;re done! The issue will be solved.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This is how you can solve the error in Compat.php while installing Magento 2 on a local server.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Related Solution: <a title=\"Call to Undefined Function bccomp in Magento 2\" href=\"https:\/\/meetanshi.com\/blog\/call-to-undefined-function-bccomp-in-magento-2\/\" target=\"_blank\" rel=\"noopener\">Call to Undefined Function bccomp() in Magento 2<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In case you are facing the Compat.php line 1927 error while installing Magento 2 in a live server, contact your respective hosting provider to enable the sodium PHP extension to solve the issue.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Found this solution helpful? Share it with your developer friends via social media and spread the knowledge!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, do not hesitate to write to us in the comments if you still have any doubts. We&#8217;d be happy to assist you.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks for reading..!  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello Magento Peeps, Stumbled upon an unexpected error in compact.php while installing Magento 2? We&#8217;ve got you covered, probably! Recently, I installed Magento 2 with&#8230;<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-2648","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2648","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=2648"}],"version-history":[{"count":1,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2648\/revisions"}],"predecessor-version":[{"id":3845,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2648\/revisions\/3845"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=2648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=2648"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=2648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}