{"id":72984,"date":"2024-10-28T21:00:38","date_gmt":"2024-10-28T13:00:38","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=72984"},"modified":"2025-04-03T23:09:53","modified_gmt":"2025-04-03T15:09:53","slug":"manage-multiple-php-versions","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/manage-multiple-php-versions\/","title":{"rendered":"5 Ways to Manage Multiple Versions of PHP"},"content":{"rendered":"<p>Managing multiple PHP versions is a common challenge when developing PHP applications, where applications often require different versions due to varying framework dependencies and compatibility requirements. While switching between PHP versions can be daunting, especially at the system level, several tools can streamline this process.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/manage-multiple-php-versions\/hero.jpg\" width=\"1600\" height=\"900\" alt=\"Managing multiple PHP versions for web development\"><\/figure>\n<p>In this article, we\u2019ll explore effective solutions for managing multiple PHP versions, helping you choose the right tool to simplify your development workflow. So, without further ado, let\u2019s get started.<\/p>\n<div class=\"ref-block ref-block--post\" id=\"ref-post-1\">\n\t\t\t\t\t<a href=\"https:\/\/www.hongkiat.com\/blog\/how-to-upgrade-php\/\" class=\"ref-block__link\" title=\"Read More: How to Upgrade PHP to Latest Version\" rel=\"bookmark\"><span class=\"screen-reader-text\">How to Upgrade PHP to Latest Version<\/span><\/a>\n<div class=\"ref-block__thumbnail img-thumb img-thumb--jumbo\" data-img='{ \"src\" : \"https:\/\/assets.hongkiat.com\/uploads\/thumbs\/250x160\/how-to-upgrade-php.jpg\" }'>\n\t\t\t\t\t\t\t<noscript>\n<style>.no-js #ref-block-post-47222 .ref-block__thumbnail { background-image: url(\"https:\/\/assets.hongkiat.com\/uploads\/thumbs\/250x160\/how-to-upgrade-php.jpg\"); }<\/style>\n<\/noscript>\n\t\t\t\t\t\t<\/div>\n<div class=\"ref-block__summary\">\n<h4 class=\"ref-title\">How to Upgrade PHP to Latest Version<\/h4>\n<p class=\"ref-description\">\n\t\t\t\t\t\tPHP7.4 has been released with a handful of new features \u2014 like the arrow function array_map(fn (Foo $foo)...\t\t\t\t\t\t<span>Read more<\/span><\/p>\n<\/div>\n<\/div>\n<hr>\n<h2>1. Using Homebrew<\/h2>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/manage-multiple-php-versions\/homebrew.jpg\" width=\"740\" height=\"200\" alt=\"Homebrew for managing PHP versions\"><\/figure>\n<div class=\"su-box su-box-style-default su-box-v7\" id=\"\" style=\"border-color:#000000;border-radius:3px\">\n<div class=\"su-box-title\" style=\"background-color:#333333;color:#FFFFFF;border-top-left-radius:1px;border-top-right-radius:1px\">Pros:<\/div>\n<div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:1px;border-bottom-right-radius:1px\">\n<ul>\n<li>Easy installation and management of multiple PHP versions.<\/li>\n<li>Quick switching between versions with simple commands.<\/li>\n<li>Regularly updated and well-maintained.<\/li>\n<li>Works seamlessly on macOS and Linux.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"su-box su-box-style-default su-box-v7\" id=\"\" style=\"border-color:#000000;border-radius:3px\">\n<div class=\"su-box-title\" style=\"background-color:#333333;color:#FFFFFF;border-top-left-radius:1px;border-top-right-radius:1px\">Cons:<\/div>\n<div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:1px;border-bottom-right-radius:1px\">\n<ul>\n<li>Only available on macOS and Linux.<\/li>\n<li>Updating can be slow and rather confusing if you\u2019re not familiar with working with the CLI.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<p><a rel=\"noopener\" target=\"_blank\" href=\"https:\/\/brew.sh\/\">Homebrew<\/a>, the popular package manager for macOS and Linux, simplifies PHP version management. After installing Homebrew from their official website, follow these steps to set up and switch between PHP versions:<\/p>\n<h3>Installing Different PHP Versions<\/h3>\n<p>To manage multiple PHP versions with Homebrew, we\u2019ll first tap into <a rel=\"noopener\" target=\"_blank\" href=\"https:\/\/github.com\/shivammathur\/homebrew-php\">Shivam Mathur\u2019s widely-used PHP repository<\/a>. This repository provides access to various PHP versions that you can install:<\/p>\n<pre>\r\nbrew tap shivammathur\/php\r\n<\/pre>\n<p>Once the repository is tapped, you can install your desired PHP versions. Here\u2019s how to install PHP 7.4, 8.2, and the latest version (currently 8.3):<\/p>\n<pre>\r\nbrew install shivammathur\/php\/php@7.4\r\nbrew install shivammathur\/php\/php@8.2\r\nbrew install shivammathur\/php\/php\r\n<\/pre>\n<p>Feel free to install any combination of versions that your projects require. Each version will be stored separately on your system.<\/p>\n<h3>Switching Between PHP Versions<\/h3>\n<p>While Homebrew allows you to install multiple PHP versions simultaneously, your system can only use one version at a time through its <code>PATH<\/code>. Think of it like having multiple PHP versions installed in your toolbox, but only one can be your active tool.<\/p>\n<p>Let\u2019s assume you are currently running PHP 8.3, but now you need to switch to PHP 7.4. First, unlink the current version to \u201cdisconnect\u201d the currently active PHP version from <code>PATH<\/code>.<\/p>\n<pre>\r\nbrew unlink php\r\n<\/pre>\n<p>After unlinking the current version, you can link the other version using the <code>brew link<\/code> command:<\/p>\n<pre>\r\nbrew link php@7.4\r\n<\/pre>\n<p>Now, when you run <code>php -v<\/code>, it will show the active PHP version as <strong>7.4<\/strong>, as you can see below.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/manage-multiple-php-versions\/brew-php-version.jpg\" width=\"740\" height=\"480\" alt=\"Checking PHP version using Homebrew\"><\/figure>\n<p>Homebrew makes it easy to use multiple PHP versions on macOS and Linux through the CLI. But it also comes with its own set of pros and cons. So consider the following when deciding if Homebrew is the right choice for you.<\/p>\n<hr>\n<h2>2. Using PHP Monitor<\/h2>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/manage-multiple-php-versions\/phpmon.jpg\" width=\"740\" height=\"200\" alt=\"PHP Monitor for managing PHP versions on macOS\"><\/figure>\n<div class=\"su-box su-box-style-default su-box-v7\" id=\"\" style=\"border-color:#000000;border-radius:3px\">\n<div class=\"su-box-title\" style=\"background-color:#333333;color:#FFFFFF;border-top-left-radius:1px;border-top-right-radius:1px\">Pros:<\/div>\n<div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:1px;border-bottom-right-radius:1px\">\n<ul>\n<li>Intuitive and user-friendly interface.<\/li>\n<li>Easy installation and management of PHP versions with only a few clicks.<\/li>\n<li>Quick switching between versions with a single click.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"su-box su-box-style-default su-box-v7\" id=\"\" style=\"border-color:#000000;border-radius:3px\">\n<div class=\"su-box-title\" style=\"background-color:#333333;color:#FFFFFF;border-top-left-radius:1px;border-top-right-radius:1px\">Cons:<\/div>\n<div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:1px;border-bottom-right-radius:1px\">\n<ul>\n<li>Only available on macOS.<\/li>\n<li>Requires and depends on Homebrew to manage PHP installations.<\/li>\n<li>Requires <a rel=\"noopener\" target=\"_blank\" href=\"https:\/\/laravel.com\/docs\/11.x\/valet\">Laravel Valet<\/a> to handle the PHP version per project.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<p><strong><a rel=\"noopener\" target=\"_blank\" href=\"https:\/\/phpmon.app\/\">PHP Monitor<\/a><\/strong> is a lightweight macOS application designed to help developers manage and switch between different PHP versions easily. It offers a familiar and intuitive UI that appears at the top of your screen, allowing you to switch between PHP versions with a single click. This app integrates with Homebrew, making it easier to manage your PHP setup without using the terminal.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/manage-multiple-php-versions\/php-monitor-ui.jpg\" width=\"740\" height=\"480\" alt=\"PHP Monitor UI showing available PHP versions\"><\/figure>\n<p>As we can see above, you can view which PHP versions are installed on your machine, the current version active globally, access the PHP configuration file, view the memory limit, and more.<\/p>\n<p>The app also provides a simple way to install and update PHP versions from the <strong>Manage PHP Installations\u2026<\/strong> menu.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/manage-multiple-php-versions\/php-monitor-manage-php-installs.jpg\" width=\"740\" height=\"480\" alt=\"Managing PHP installations in PHP Monitor\"><\/figure>\n<hr>\n<h2>3. Using PHPCTL<\/h2>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/manage-multiple-php-versions\/phpctl.jpg\" width=\"740\" height=\"200\" alt=\"PHPCTL tool for managing PHP versions with Docker\"><\/figure>\n<div class=\"su-box su-box-style-default su-box-v7\" id=\"\" style=\"border-color:#000000;border-radius:3px\">\n<div class=\"su-box-title\" style=\"background-color:#333333;color:#FFFFFF;border-top-left-radius:1px;border-top-right-radius:1px\">Pros:<\/div>\n<div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:1px;border-bottom-right-radius:1px\">\n<ul>\n<li>Platform-independent and portable.<\/li>\n<li>Provides additional CLI tools for new projects, interactive shells, and other popular tools in PHP like PHPCS, PHPUnit, RectorPHP, etc.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"su-box su-box-style-default su-box-v7\" id=\"\" style=\"border-color:#000000;border-radius:3px\">\n<div class=\"su-box-title\" style=\"background-color:#333333;color:#FFFFFF;border-top-left-radius:1px;border-top-right-radius:1px\">Cons:<\/div>\n<div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:1px;border-bottom-right-radius:1px\">\n<ul>\n<li>Requires Docker to be installed on your system.<\/li>\n<li>Requires manual configuration of the <code>.phpctlrc<\/code> file to switch between PHP versions.<\/li>\n<li>Docker may consume more resources than other solutions.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<p><strong><a rel=\"noopener\" target=\"_blank\" href=\"https:\/\/phpctl.dev\">PHPCTL<\/a><\/strong> is a tool designed to help developers easily switch between different PHP versions by leveraging <a rel=\"noopener\" target=\"_blank\" href=\"https:\/\/www.docker.com\/resources\/what-container\/\">Docker containers<\/a>. This makes PHPCTL portable and platform-independent, allowing you to manage PHP versions on any operating system that supports Docker. It also provides additional CLI tools, such as <code>phpctl create<\/code> for new projects, <code>phpctl repl<\/code> for interactive shells, and <code>phpctl init<\/code> for configuration setup, among other handy features.<\/p>\n<h3>Install PHPCTL<\/h3>\n<p>Before getting started, you\u2019ll need Docker installed on your system. <a rel=\"noopener\" target=\"_blank\" href=\"https:\/\/www.docker.com\/products\/docker-desktop\/\">Docker Desktop<\/a> works great, or if you\u2019re on macOS, you might prefer <a rel=\"noopener\" target=\"_blank\" href=\"https:\/\/orbstack.dev\/\">OrbStack<\/a>.<\/p>\n<p>Once you have Docker installed, you can install PHPCTL using the following command:<\/p>\n<pre>\r\n\/bin\/bash -c \"$(curl -fsSL https:\/\/phpctl.dev\/install.sh)\"\r\n<\/pre>\n<p>Or, if you have Homebrew installed, you can run:<\/p>\n<pre>\r\nbrew install opencodeco\/phpctl\/phpctl\r\n<\/pre>\n<p>This will download the PHPCTL binary to your system and make it executable, allowing you to use the tool right away. The script automatically installs PHPCTL and sets up the necessary paths, so no manual configuration is required.<\/p>\n<p>After installation, you can check if it was successfully installed by running:<\/p>\n<pre>\r\nphpctl list\r\n<\/pre>\n<p>This command will list all the subcommands and other information about the current PHP installation, as you can see below.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/manage-multiple-php-versions\/phpctl-list.jpg\" width=\"740\" height=\"480\" alt=\"PHPCTL command listing available subcommands and PHP info\"><\/figure>\n<p>You can also run the <code>php<\/code> and <code>composer<\/code> commands directly.<\/p>\n<pre>\r\nphp -v\r\ncomposer -v\r\n<\/pre>\n<p>These two commands will actually run inside a Docker container. PHPCTL will automatically mount the current directory to the container, so you can work on your project as if you were working on your local machine.<\/p>\n<h3>Switching Between PHP Versions<\/h3>\n<p>Unlike with Homebrew or PHP Monitor, where you need to run a command or click on the UI to switch to the PHP version, with PHPCTL, you will need to create a file <code>.phpctlrc<\/code> and specify which PHP version you\u2019d like to run within the given directory.<\/p>\n<pre>\r\nPHP_VERSION=83\r\n<\/pre>\n<p>When you run <code>php<\/code> or <code>composer<\/code> in the directory, PHPCTL will automatically switch to the PHP version specified in the <code>.phpctlrc<\/code> file.<\/p>\n<p>That\u2019s all. It\u2019s very convenient and provides a seamless development experience once it is fully configured. However, it also comes with its own set of pros and cons.<\/p>\n<hr>\n<h2>4. Using PVM<\/h2>\n<div class=\"su-box su-box-style-default su-box-v7\" id=\"\" style=\"border-color:#000000;border-radius:3px\">\n<div class=\"su-box-title\" style=\"background-color:#333333;color:#FFFFFF;border-top-left-radius:1px;border-top-right-radius:1px\">Pros:<\/div>\n<div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:1px;border-bottom-right-radius:1px\">\n<ul>\n<li>Easy installation and management of PHP versions on Windows.<\/li>\n<li>Very similar to nvm, making it quick and easy to get familiar with.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"su-box su-box-style-default su-box-v7\" id=\"\" style=\"border-color:#000000;border-radius:3px\">\n<div class=\"su-box-title\" style=\"background-color:#333333;color:#FFFFFF;border-top-left-radius:1px;border-top-right-radius:1px\">Cons:<\/div>\n<div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:1px;border-bottom-right-radius:1px\">\n<ul>\n<li>Only available on Windows.<\/li>\n<li>Installation is a bit of a manual process.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<p>PVM simplifies PHP version management on Windows. Similar to <a rel=\"noopener\" target=\"_blank\" href=\"https:\/\/github.com\/nvm-sh\/nvm\">Node Version Manager (nvm)<\/a> but specifically for PHP, PVM eliminates common Windows <code>PATH<\/code> variable headaches and streamlines switching between different PHP versions.<\/p>\n<h3>Install PVM<\/h3>\n<p>Download the latest PVM release from the <a rel=\"noopener\" target=\"_blank\" href=\"https:\/\/github.com\/hjbdev\/pvm\/releases\/tag\/1.1\">official Github repository<\/a>. Then, create a folder at <code>C:\\Users\\YourUsername\\.pvm\\bin<\/code> and place the downloaded <code>pvm.exe<\/code> in this folder.<\/p>\n<p>Lastly, add the <code>.pvm\\bin<\/code> folder to your system\u2019s <code>PATH<\/code> variable through <strong>System Properties > Environment Variables<\/strong>.<\/p>\n<p>Once installed, you can use PVM to switch between PHP versions quickly and easily. Since it is heavily inspired by nvm, the commands are similar. Here are some commands to get you started:<\/p>\n<h3>Installing PHP with PVM<\/h3>\n<p>PVM makes it easier to install multiple PHP versions on Windows. If you need a version that\u2019s not currently installed on your computer, you can use the install command:<\/p>\n<pre>\r\npvm install 8.2\r\n<\/pre>\n<p>\u2026which will download and install PHP 8.2 on your computer.<\/p>\n<h3>Switching PHP Versions with PVM<\/h3>\n<p>If you want to switch to a specific PHP version, use the use command. You must specify at least the major and minor version, and PVM will choose the latest available patch version if it\u2019s not provided.<\/p>\n<pre>pvm use 8.2<\/pre>\n<p>If you want to switch to a specific patch version, include the patch number as well:<\/p>\n<pre>pvm use 8.2.3<\/pre>\n<p>That\u2019s all. PVM is a great tool for managing PHP versions on Windows, but it also comes with its own set of pros and cons.<\/p>\n<hr>\n<h2>5. Using Valet<\/h2>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/manage-multiple-php-versions\/laravel-valet.jpg\" alt=\"Laravel Valet\" width=\"1500\" height=\"836\"><\/figure>\n<div class=\"su-box su-box-style-default su-box-v7\" id=\"\" style=\"border-color:#000000;border-radius:3px\">\n<div class=\"su-box-title\" style=\"background-color:#333333;color:#FFFFFF;border-top-left-radius:1px;border-top-right-radius:1px\">Pros:<\/div>\n<div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:1px;border-bottom-right-radius:1px\">\n<ul>\n<li>Easy installation and management of PHP versions on macOS.<\/li>\n<li>Quick switching between PHP versions for different projects.<\/li>\n<li>Works seamlessly with Laravel projects and supports other types of projects like WordPress, Symfony, etc.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"su-box su-box-style-default su-box-v7\" id=\"\" style=\"border-color:#000000;border-radius:3px\">\n<div class=\"su-box-title\" style=\"background-color:#333333;color:#FFFFFF;border-top-left-radius:1px;border-top-right-radius:1px\">Cons:<\/div>\n<div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:1px;border-bottom-right-radius:1px\">\n<ul>\n<li>Only available on macOS.<\/li>\n<li>Requires and depends on Homebrew to manage PHP installations.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<p><a rel=\"noopener\" target=\"_blank\" href=\"https:\/\/laravel.com\/docs\/11.x\/valet\">Laravel Valet<\/a> is a lightweight development environment designed specifically for macOS that makes PHP development a breeze. What makes Valet particularly convenient is its built-in PHP version management that allows you to switch between PHP versions for different projects without complex configurations.<\/p>\n<h3>Install Valet<\/h3>\n<p>To get started, install Valet using Composer as a global package:<\/p>\n<pre>\r\ncomposer global require laravel\/valet\r\n<\/pre>\n<p>After installation, run the Valet installation command:<\/p>\n<pre>\r\nvalet install\r\n<\/pre>\n<h3>Switching PHP Versions with Valet<\/h3>\n<p>Valet makes PHP version switching simple with the <code>valet use php@version<\/code> command. For example:<\/p>\n<pre>\r\nvalet use php@8.2\r\n<\/pre>\n<p>It automatically installs the version via Homebrew if it\u2019s currently missing.<\/p>\n<p>For project-specific PHP versions, you can create a <code>.valetrc<\/code> file in your project\u2019s root directory with the line <code>php=php@8.2<\/code>. Then, simply run:<\/p>\n<pre>\r\nvalet use\r\n<\/pre>\n<p>\u2026and Valet will automatically switch to the PHP version specified in the <code>.valetrc<\/code> file.<\/p>\n<hr>\n<h2>Wrapping Up<\/h2>\n<p>With the right tools, managing multiple PHP versions becomes effortless across macOS, Linux, or Windows. Hopefully, this article helps you pick the solution that matches your workflow.<\/p>","protected":false},"excerpt":{"rendered":"<p>Managing multiple PHP versions is a common challenge when developing PHP applications, where applications often require different versions due to varying framework dependencies and compatibility requirements. While switching between PHP versions can be daunting, especially at the system level, several tools can streamline this process. In this article, we\u2019ll explore effective solutions for managing multiple&hellip;<\/p>\n","protected":false},"author":113,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3392],"tags":[1319,3213],"topic":[],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>5 Ways to Manage Multiple Versions of PHP - Hongkiat<\/title>\n<meta name=\"description\" content=\"Managing multiple PHP versions is a common challenge when developing PHP applications, where applications often require different versions due to varying\" \/>\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.hongkiat.com\/blog\/manage-multiple-php-versions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"5 Ways to Manage Multiple Versions of PHP\" \/>\n<meta property=\"og:description\" content=\"Managing multiple PHP versions is a common challenge when developing PHP applications, where applications often require different versions due to varying\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/manage-multiple-php-versions\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-28T13:00:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-03T15:09:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/assets.hongkiat.com\/uploads\/manage-multiple-php-versions\/hero.jpg\" \/>\n<meta name=\"author\" content=\"Thoriq Firdaus\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@tfirdaus\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Thoriq Firdaus\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/manage-multiple-php-versions\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/manage-multiple-php-versions\\\/\"},\"author\":{\"name\":\"Thoriq Firdaus\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e7948c7a175d211496331e4b6ce55807\"},\"headline\":\"5 Ways to Manage Multiple Versions of PHP\",\"datePublished\":\"2024-10-28T13:00:38+00:00\",\"dateModified\":\"2025-04-03T15:09:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/manage-multiple-php-versions\\\/\"},\"wordCount\":1490,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/manage-multiple-php-versions\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/manage-multiple-php-versions\\\/hero.jpg\",\"keywords\":[\"PHP\",\"version control\"],\"articleSection\":[\"Coding\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/manage-multiple-php-versions\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/manage-multiple-php-versions\\\/\",\"name\":\"5 Ways to Manage Multiple Versions of PHP - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/manage-multiple-php-versions\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/manage-multiple-php-versions\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/manage-multiple-php-versions\\\/hero.jpg\",\"datePublished\":\"2024-10-28T13:00:38+00:00\",\"dateModified\":\"2025-04-03T15:09:53+00:00\",\"description\":\"Managing multiple PHP versions is a common challenge when developing PHP applications, where applications often require different versions due to varying\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/manage-multiple-php-versions\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/manage-multiple-php-versions\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/manage-multiple-php-versions\\\/#primaryimage\",\"url\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/manage-multiple-php-versions\\\/hero.jpg\",\"contentUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/manage-multiple-php-versions\\\/hero.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/manage-multiple-php-versions\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"5 Ways to Manage Multiple Versions of PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e7948c7a175d211496331e4b6ce55807\",\"name\":\"Thoriq Firdaus\",\"description\":\"Thoriq is a writer for Hongkiat.com with a passion for web design and development. He is the author of Responsive Web Design by Examples, where he covered his best approaches in developing responsive websites quickly with a framework.\",\"sameAs\":[\"https:\\\/\\\/thoriq.com\",\"https:\\\/\\\/x.com\\\/tfirdaus\"],\"jobTitle\":\"Web Developer\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/thoriq\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"5 Ways to Manage Multiple Versions of PHP - Hongkiat","description":"Managing multiple PHP versions is a common challenge when developing PHP applications, where applications often require different versions due to varying","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.hongkiat.com\/blog\/manage-multiple-php-versions\/","og_locale":"en_US","og_type":"article","og_title":"5 Ways to Manage Multiple Versions of PHP","og_description":"Managing multiple PHP versions is a common challenge when developing PHP applications, where applications often require different versions due to varying","og_url":"https:\/\/www.hongkiat.com\/blog\/manage-multiple-php-versions\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2024-10-28T13:00:38+00:00","article_modified_time":"2025-04-03T15:09:53+00:00","og_image":[{"url":"https:\/\/assets.hongkiat.com\/uploads\/manage-multiple-php-versions\/hero.jpg","type":"","width":"","height":""}],"author":"Thoriq Firdaus","twitter_card":"summary_large_image","twitter_creator":"@tfirdaus","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Thoriq Firdaus","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/manage-multiple-php-versions\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/manage-multiple-php-versions\/"},"author":{"name":"Thoriq Firdaus","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e7948c7a175d211496331e4b6ce55807"},"headline":"5 Ways to Manage Multiple Versions of PHP","datePublished":"2024-10-28T13:00:38+00:00","dateModified":"2025-04-03T15:09:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/manage-multiple-php-versions\/"},"wordCount":1490,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/manage-multiple-php-versions\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/manage-multiple-php-versions\/hero.jpg","keywords":["PHP","version control"],"articleSection":["Coding"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/manage-multiple-php-versions\/","url":"https:\/\/www.hongkiat.com\/blog\/manage-multiple-php-versions\/","name":"5 Ways to Manage Multiple Versions of PHP - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/manage-multiple-php-versions\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/manage-multiple-php-versions\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/manage-multiple-php-versions\/hero.jpg","datePublished":"2024-10-28T13:00:38+00:00","dateModified":"2025-04-03T15:09:53+00:00","description":"Managing multiple PHP versions is a common challenge when developing PHP applications, where applications often require different versions due to varying","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/manage-multiple-php-versions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/manage-multiple-php-versions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/manage-multiple-php-versions\/#primaryimage","url":"https:\/\/assets.hongkiat.com\/uploads\/manage-multiple-php-versions\/hero.jpg","contentUrl":"https:\/\/assets.hongkiat.com\/uploads\/manage-multiple-php-versions\/hero.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/manage-multiple-php-versions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"5 Ways to Manage Multiple Versions of PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e7948c7a175d211496331e4b6ce55807","name":"Thoriq Firdaus","description":"Thoriq is a writer for Hongkiat.com with a passion for web design and development. He is the author of Responsive Web Design by Examples, where he covered his best approaches in developing responsive websites quickly with a framework.","sameAs":["https:\/\/thoriq.com","https:\/\/x.com\/tfirdaus"],"jobTitle":"Web Developer","url":"https:\/\/www.hongkiat.com\/blog\/author\/thoriq\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-iZa","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/72984","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/113"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=72984"}],"version-history":[{"count":4,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/72984\/revisions"}],"predecessor-version":[{"id":73464,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/72984\/revisions\/73464"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=72984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=72984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=72984"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=72984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}