{"id":4263,"date":"2026-02-09T09:34:07","date_gmt":"2026-02-09T09:34:07","guid":{"rendered":"https:\/\/www.devopsconsulting.in\/blog\/?p=4263"},"modified":"2026-02-09T09:34:08","modified_gmt":"2026-02-09T09:34:08","slug":"install-and-enable-the-gmp-extension-in-linux","status":"publish","type":"post","link":"https:\/\/www.devopsconsulting.in\/blog\/install-and-enable-the-gmp-extension-in-linux\/","title":{"rendered":"Install, and enable the GMP extension in linux"},"content":{"rendered":"\n<p>since you are using <strong>XAMPP PHP located at <code>\/opt\/lampp\/bin\/php<\/code> (version 8.2.12)<\/strong>, you must <strong>build, install, and enable the GMP extension for this exact PHP version<\/strong>.<br>Follow these steps carefully.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">ONE-COMMAND GMP INSTALL (XAMPP PHP 8.2.12)<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update &amp;&amp; \\\nsudo apt install -y build-essential autoconf automake libtool pkg-config libgmp-dev re2c bison wget &amp;&amp; \\\ncd \/tmp &amp;&amp; \\\nwget -q https:\/\/www.php.net\/distributions\/php-8.2.12.tar.gz &amp;&amp; \\\ntar -xzf php-8.2.12.tar.gz &amp;&amp; \\\ncd php-8.2.12\/ext\/gmp &amp;&amp; \\\n\/opt\/lampp\/bin\/phpize &amp;&amp; \\\n.\/configure --with-php-config=\/opt\/lampp\/bin\/php-config &amp;&amp; \\\nmake -j\"$(nproc)\" &amp;&amp; \\\nsudo make install &amp;&amp; \\\ngrep -q '^extension=gmp.so' \/opt\/lampp\/etc\/php.ini || echo 'extension=gmp.so' | sudo tee -a \/opt\/lampp\/etc\/php.ini &amp;&amp; \\\nsudo \/opt\/lampp\/lampp restart &amp;&amp; \\\n\/opt\/lampp\/bin\/php -m | grep -i gmp &amp;&amp; \\\n\/opt\/lampp\/bin\/php -r 'echo function_exists(\"gmp_init\") ? \"GMP OK\\n\" : \"GMP NOT OK\\n\";'\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 0: Check your XAMPP PHP version<\/h2>\n\n\n\n<p>Run this command to confirm the PHP version you are using:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/opt\/lampp\/bin\/php -v\n<\/code><\/pre>\n\n\n\n<p>You should see <strong>PHP 8.2.12<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Install required build packages (Ubuntu\/Debian)<\/h2>\n\n\n\n<p>These packages are required to compile the GMP extension.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install -y build-essential autoconf automake libtool pkg-config libgmp-dev re2c bison\n<\/code><\/pre>\n\n\n\n<p>\u26a0\ufe0f <strong>Important:<\/strong><br><code>libgmp-dev<\/code> is mandatory. Without it, GMP will not compile.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Download PHP source code (same version: 8.2.12)<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/tmp\nwget https:\/\/www.php.net\/distributions\/php-8.2.12.tar.gz\ntar -xzf php-8.2.12.tar.gz\n<\/code><\/pre>\n\n\n\n<p>This gives you the PHP source files needed to compile extensions.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Compile GMP extension using XAMPP PHP<\/h2>\n\n\n\n<p>Go to the GMP extension directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/tmp\/php-8.2.12\/ext\/gmp\n<\/code><\/pre>\n\n\n\n<p>Now run these commands <strong>using XAMPP\u2019s phpize and php-config<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/opt\/lampp\/bin\/phpize\n.\/configure --with-php-config=\/opt\/lampp\/bin\/php-config\nmake -j\"$(nproc)\"\nsudo make install\n<\/code><\/pre>\n\n\n\n<p>\u2705 After this, the file <strong><code>gmp.so<\/code><\/strong> will be installed in XAMPP\u2019s PHP extension directory.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Confirm <code>gmp.so<\/code> is installed<\/h2>\n\n\n\n<p>Run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>EXT_DIR=$(\/opt\/lampp\/bin\/php -r 'echo ini_get(\"extension_dir\");')\necho \"EXT_DIR=$EXT_DIR\"\nls -l \"$EXT_DIR\" | grep -i gmp\n<\/code><\/pre>\n\n\n\n<p>Expected result:<br>You should see <strong><code>gmp.so<\/code><\/strong> listed.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Enable GMP in XAMPP php.ini<\/h2>\n\n\n\n<p>Open the XAMPP PHP configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/opt\/lampp\/etc\/php.ini\n<\/code><\/pre>\n\n\n\n<p>Edit it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vi \/opt\/lampp\/etc\/php.ini\n<\/code><\/pre>\n\n\n\n<p>Search for GMP:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Press <code>\/gmp<\/code> and hit Enter<\/li>\n<\/ul>\n\n\n\n<p>Make sure this line exists <strong>exactly like this<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>extension=gmp.so\n<\/code><\/pre>\n\n\n\n<p>\u26a0\ufe0f If you see:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>extension=gmp\n<\/code><\/pre>\n\n\n\n<p>Change it to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>extension=gmp.so\n<\/code><\/pre>\n\n\n\n<p>Save and exit:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Type <code>:wq<\/code> and press Enter<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 6: Restart XAMPP<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/opt\/lampp\/lampp restart\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 7: Verify GMP is enabled<\/h2>\n\n\n\n<p>Check loaded PHP modules:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/opt\/lampp\/bin\/php -m | grep -i gmp\n<\/code><\/pre>\n\n\n\n<p>Expected output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gmp\n<\/code><\/pre>\n\n\n\n<p>Extra check:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/opt\/lampp\/bin\/php -r 'echo function_exists(\"gmp_init\") ? \"GMP OK\\n\" : \"GMP NOT OK\\n\";'\n<\/code><\/pre>\n\n\n\n<p>Expected output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GMP OK\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">If you get an error in Step 3<\/h2>\n\n\n\n<p>Run these commands and share the error output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/opt\/lampp\/bin\/phpize -v\n\/opt\/lampp\/bin\/php-config --version\n<\/code><\/pre>\n\n\n\n<p>Also copy and paste any error messages from:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>.\/configure<\/code><\/li>\n\n\n\n<li><code>make<\/code><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">ONE-COMMAND GMP INSTALL (XAMPP PHP 8.2.12)<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update &amp;&amp; \\\nsudo apt install -y build-essential autoconf automake libtool pkg-config libgmp-dev re2c bison wget &amp;&amp; \\\ncd \/tmp &amp;&amp; \\\nwget -q https:\/\/www.php.net\/distributions\/php-8.2.12.tar.gz &amp;&amp; \\\ntar -xzf php-8.2.12.tar.gz &amp;&amp; \\\ncd php-8.2.12\/ext\/gmp &amp;&amp; \\\n\/opt\/lampp\/bin\/phpize &amp;&amp; \\\n.\/configure --with-php-config=\/opt\/lampp\/bin\/php-config &amp;&amp; \\\nmake -j\"$(nproc)\" &amp;&amp; \\\nsudo make install &amp;&amp; \\\ngrep -q '^extension=gmp.so' \/opt\/lampp\/etc\/php.ini || echo 'extension=gmp.so' | sudo tee -a \/opt\/lampp\/etc\/php.ini &amp;&amp; \\\nsudo \/opt\/lampp\/lampp restart &amp;&amp; \\\n\/opt\/lampp\/bin\/php -m | grep -i gmp &amp;&amp; \\\n\/opt\/lampp\/bin\/php -r 'echo function_exists(\"gmp_init\") ? \"GMP OK\\n\" : \"GMP NOT OK\\n\";'\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>since you are using XAMPP PHP located at \/opt\/lampp\/bin\/php (version 8.2.12), you must build, install, and enable the GMP extension [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4263","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Install, and enable the GMP extension in linux - DevOps Consulting<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.devopsconsulting.in\/blog\/install-and-enable-the-gmp-extension-in-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Install, and enable the GMP extension in linux - DevOps Consulting\" \/>\n<meta property=\"og:description\" content=\"since you are using XAMPP PHP located at \/opt\/lampp\/bin\/php (version 8.2.12), you must build, install, and enable the GMP extension [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.devopsconsulting.in\/blog\/install-and-enable-the-gmp-extension-in-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"DevOps Consulting\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-09T09:34:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-09T09:34:08+00:00\" \/>\n<meta name=\"author\" content=\"Abhishek Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Abhishek Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.devopsconsulting.in\/blog\/install-and-enable-the-gmp-extension-in-linux\/\",\"url\":\"https:\/\/www.devopsconsulting.in\/blog\/install-and-enable-the-gmp-extension-in-linux\/\",\"name\":\"Install, and enable the GMP extension in linux - DevOps Consulting\",\"isPartOf\":{\"@id\":\"https:\/\/www.devopsconsulting.in\/blog\/#website\"},\"datePublished\":\"2026-02-09T09:34:07+00:00\",\"dateModified\":\"2026-02-09T09:34:08+00:00\",\"author\":{\"@id\":\"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/fc397ba8be42f9fdd53450edfc73006f\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.devopsconsulting.in\/blog\/install-and-enable-the-gmp-extension-in-linux\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.devopsconsulting.in\/blog\/#website\",\"url\":\"https:\/\/www.devopsconsulting.in\/blog\/\",\"name\":\"DevOps Consulting\",\"description\":\"DevOps Consulting | SRE Consulting | DevSecOps Consulting | MLOps Consulting\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.devopsconsulting.in\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/fc397ba8be42f9fdd53450edfc73006f\",\"name\":\"Abhishek Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g\",\"caption\":\"Abhishek Singh\"},\"description\":\"I\u2019m Abhishek, a DevOps, SRE, DevSecOps, and Cloud expert with a passion for sharing knowledge and real-world experiences. I\u2019ve had the opportunity to work with Cotocus and continue to contribute to multiple platforms where I share insights across different domains: \u2022 DevOps School \u2013 Tech blogs and tutorials \u2022 Holiday Landmark \u2013 Travel stories and guides \u2022 Stocks Mantra \u2013 Stock market strategies and tips \u2022 My Medic Plus \u2013 Health and fitness guidance \u2022 TrueReviewNow \u2013 Honest product reviews \u2022 Wizbrand \u2013 SEO and digital tools for businesses I\u2019m also exploring the fascinating world of Quantum Computing.\",\"url\":\"https:\/\/www.devopsconsulting.in\/blog\/author\/abhishek\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Install, and enable the GMP extension in linux - DevOps Consulting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.devopsconsulting.in\/blog\/install-and-enable-the-gmp-extension-in-linux\/","og_locale":"en_US","og_type":"article","og_title":"Install, and enable the GMP extension in linux - DevOps Consulting","og_description":"since you are using XAMPP PHP located at \/opt\/lampp\/bin\/php (version 8.2.12), you must build, install, and enable the GMP extension [&hellip;]","og_url":"https:\/\/www.devopsconsulting.in\/blog\/install-and-enable-the-gmp-extension-in-linux\/","og_site_name":"DevOps Consulting","article_published_time":"2026-02-09T09:34:07+00:00","article_modified_time":"2026-02-09T09:34:08+00:00","author":"Abhishek Singh","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Abhishek Singh","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.devopsconsulting.in\/blog\/install-and-enable-the-gmp-extension-in-linux\/","url":"https:\/\/www.devopsconsulting.in\/blog\/install-and-enable-the-gmp-extension-in-linux\/","name":"Install, and enable the GMP extension in linux - DevOps Consulting","isPartOf":{"@id":"https:\/\/www.devopsconsulting.in\/blog\/#website"},"datePublished":"2026-02-09T09:34:07+00:00","dateModified":"2026-02-09T09:34:08+00:00","author":{"@id":"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/fc397ba8be42f9fdd53450edfc73006f"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.devopsconsulting.in\/blog\/install-and-enable-the-gmp-extension-in-linux\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.devopsconsulting.in\/blog\/#website","url":"https:\/\/www.devopsconsulting.in\/blog\/","name":"DevOps Consulting","description":"DevOps Consulting | SRE Consulting | DevSecOps Consulting | MLOps Consulting","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.devopsconsulting.in\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/fc397ba8be42f9fdd53450edfc73006f","name":"Abhishek Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g","caption":"Abhishek Singh"},"description":"I\u2019m Abhishek, a DevOps, SRE, DevSecOps, and Cloud expert with a passion for sharing knowledge and real-world experiences. I\u2019ve had the opportunity to work with Cotocus and continue to contribute to multiple platforms where I share insights across different domains: \u2022 DevOps School \u2013 Tech blogs and tutorials \u2022 Holiday Landmark \u2013 Travel stories and guides \u2022 Stocks Mantra \u2013 Stock market strategies and tips \u2022 My Medic Plus \u2013 Health and fitness guidance \u2022 TrueReviewNow \u2013 Honest product reviews \u2022 Wizbrand \u2013 SEO and digital tools for businesses I\u2019m also exploring the fascinating world of Quantum Computing.","url":"https:\/\/www.devopsconsulting.in\/blog\/author\/abhishek\/"}]}},"_links":{"self":[{"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/posts\/4263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/comments?post=4263"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/posts\/4263\/revisions"}],"predecessor-version":[{"id":4272,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/posts\/4263\/revisions\/4272"}],"wp:attachment":[{"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/media?parent=4263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/categories?post=4263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/tags?post=4263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}