{"id":1349,"date":"2024-11-04T05:38:40","date_gmt":"2024-11-04T05:38:40","guid":{"rendered":"https:\/\/www.devopsconsulting.in\/blog\/?p=1349"},"modified":"2024-11-04T05:48:36","modified_gmt":"2024-11-04T05:48:36","slug":"how-run-multiple-php-version-in-same-xampp-version","status":"publish","type":"post","link":"https:\/\/www.devopsconsulting.in\/blog\/how-run-multiple-php-version-in-same-xampp-version\/","title":{"rendered":"how run multiple php version in same xampp version"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">To run multiple PHP versions on the same XAMPP installation, follow these steps:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Download the Additional PHP Versions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to <a href=\"https:\/\/www.php.net\/downloads\">PHP\u2019s official website<\/a> and download the additional PHP versions you need.<\/li>\n\n\n\n<li>Extract the PHP version files into the <code>xampp<\/code> directory, creating separate folders for each version, such as <code>xampp\/php7.4<\/code> and <code>xampp\/php8.0<\/code>.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">2. Configure Apache to Use Different PHP Versions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the XAMPP Control Panel and stop Apache if it&#8217;s running.<\/li>\n\n\n\n<li>Go to the <code>xampp\/apache\/conf\/extra\/<\/code> directory and open the <code>httpd-xampp.conf<\/code> file in a text editor.<\/li>\n\n\n\n<li>Find the following lines (these specify the default PHP version):<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   LoadFile \"C:\/xampp\/php\/php7\/php7ts.dll\"\n   LoadModule php7_module \"C:\/xampp\/php\/php7\/php7apache2_4.dll\"\n   PHPIniDir \"C:\/xampp\/php\/php7\"<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li>Replace the above paths with a variable so you can easily switch between PHP versions.<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Define the PHP version path variables at the beginning of the file: <code>Define php7 \"C:\/xampp\/php7.4\" Define php8 \"C:\/xampp\/php8.0\"<\/code><\/li>\n\n\n\n<li>Add these conditionally loaded versions in separate <code>&lt;IfModule&gt;<\/code> blocks:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>&lt;IfModule php7_module> LoadFile \"${php7}\/php7ts.dll\" LoadModule php7_module \"${php7}\/php7apache2_4.dll\" PHPIniDir \"${php7}\" &lt;\/IfModule> &lt;IfModule php8_module> LoadFile \"${php8}\/php8ts.dll\" LoadModule php8_module \"${php8}\/php8apache2_4.dll\" PHPIniDir \"${php8}\" &lt;\/IfModule><\/code><\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li>To switch PHP versions, comment out or uncomment the relevant block in <code>httpd-xampp.conf<\/code> for the version you want to use.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">3. Create Virtual Hosts for Each PHP Version (Optional)<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the <code>httpd-vhosts.conf<\/code> file located in <code>xampp\/apache\/conf\/extra\/<\/code>.<\/li>\n\n\n\n<li>Add separate virtual host entries for each PHP version, pointing each one to the PHP directory version you want to use:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   &lt;VirtualHost *:80&gt;\n       DocumentRoot \"C:\/xampp\/htdocs\"\n       ServerName php7.local\n       SetEnv PHP_VERSION php7\n   &lt;\/VirtualHost&gt;\n\n   &lt;VirtualHost *:80&gt;\n       DocumentRoot \"C:\/xampp\/htdocs\"\n       ServerName php8.local\n       SetEnv PHP_VERSION php8\n   &lt;\/VirtualHost&gt;<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li>Update your <code>hosts<\/code> file to include these domain names:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   127.0.0.1 php7.local\n   127.0.0.1 php8.local<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li>Now, when you visit <code>http:\/\/php7.local<\/code>, it will use PHP 7, and <code>http:\/\/php8.local<\/code> will use PHP 8.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">4. Restart Apache<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Return to the XAMPP Control Panel and start Apache. Now, you can run different PHP versions on the same XAMPP installation using either conditional loading in <code>httpd-xampp.conf<\/code> or virtual hosts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To run multiple PHP versions on the same XAMPP installation, follow these steps: 1. Download the Additional PHP Versions 2. Configure Apache to Use Different PHP Versions&#8230; <\/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-1349","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>how run multiple php version in same xampp version - 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\/how-run-multiple-php-version-in-same-xampp-version\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"how run multiple php version in same xampp version - DevOps Consulting\" \/>\n<meta property=\"og:description\" content=\"To run multiple PHP versions on the same XAMPP installation, follow these steps: 1. Download the Additional PHP Versions 2. Configure Apache to Use Different PHP Versions...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.devopsconsulting.in\/blog\/how-run-multiple-php-version-in-same-xampp-version\/\" \/>\n<meta property=\"og:site_name\" content=\"DevOps Consulting\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-04T05:38:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-04T05:48:36+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\":\"Article\",\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/how-run-multiple-php-version-in-same-xampp-version\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/how-run-multiple-php-version-in-same-xampp-version\\\/\"},\"author\":{\"name\":\"Abhishek Singh\",\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/#\\\/schema\\\/person\\\/fc397ba8be42f9fdd53450edfc73006f\"},\"headline\":\"how run multiple php version in same xampp version\",\"datePublished\":\"2024-11-04T05:38:40+00:00\",\"dateModified\":\"2024-11-04T05:48:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/how-run-multiple-php-version-in-same-xampp-version\\\/\"},\"wordCount\":238,\"commentCount\":0,\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/how-run-multiple-php-version-in-same-xampp-version\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/how-run-multiple-php-version-in-same-xampp-version\\\/\",\"url\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/how-run-multiple-php-version-in-same-xampp-version\\\/\",\"name\":\"how run multiple php version in same xampp version - DevOps Consulting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/#website\"},\"datePublished\":\"2024-11-04T05:38:40+00:00\",\"dateModified\":\"2024-11-04T05:48:36+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/#\\\/schema\\\/person\\\/fc397ba8be42f9fdd53450edfc73006f\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/how-run-multiple-php-version-in-same-xampp-version\\\/\"]}]},{\"@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:\\\/\\\/secure.gravatar.com\\\/avatar\\\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g\",\"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":"how run multiple php version in same xampp version - 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\/how-run-multiple-php-version-in-same-xampp-version\/","og_locale":"en_US","og_type":"article","og_title":"how run multiple php version in same xampp version - DevOps Consulting","og_description":"To run multiple PHP versions on the same XAMPP installation, follow these steps: 1. Download the Additional PHP Versions 2. Configure Apache to Use Different PHP Versions...","og_url":"https:\/\/www.devopsconsulting.in\/blog\/how-run-multiple-php-version-in-same-xampp-version\/","og_site_name":"DevOps Consulting","article_published_time":"2024-11-04T05:38:40+00:00","article_modified_time":"2024-11-04T05:48:36+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":"Article","@id":"https:\/\/www.devopsconsulting.in\/blog\/how-run-multiple-php-version-in-same-xampp-version\/#article","isPartOf":{"@id":"https:\/\/www.devopsconsulting.in\/blog\/how-run-multiple-php-version-in-same-xampp-version\/"},"author":{"name":"Abhishek Singh","@id":"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/fc397ba8be42f9fdd53450edfc73006f"},"headline":"how run multiple php version in same xampp version","datePublished":"2024-11-04T05:38:40+00:00","dateModified":"2024-11-04T05:48:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.devopsconsulting.in\/blog\/how-run-multiple-php-version-in-same-xampp-version\/"},"wordCount":238,"commentCount":0,"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.devopsconsulting.in\/blog\/how-run-multiple-php-version-in-same-xampp-version\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.devopsconsulting.in\/blog\/how-run-multiple-php-version-in-same-xampp-version\/","url":"https:\/\/www.devopsconsulting.in\/blog\/how-run-multiple-php-version-in-same-xampp-version\/","name":"how run multiple php version in same xampp version - DevOps Consulting","isPartOf":{"@id":"https:\/\/www.devopsconsulting.in\/blog\/#website"},"datePublished":"2024-11-04T05:38:40+00:00","dateModified":"2024-11-04T05:48:36+00:00","author":{"@id":"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/fc397ba8be42f9fdd53450edfc73006f"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.devopsconsulting.in\/blog\/how-run-multiple-php-version-in-same-xampp-version\/"]}]},{"@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:\/\/secure.gravatar.com\/avatar\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g","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\/1349","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=1349"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/posts\/1349\/revisions"}],"predecessor-version":[{"id":1353,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/posts\/1349\/revisions\/1353"}],"wp:attachment":[{"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/media?parent=1349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/categories?post=1349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/tags?post=1349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}