PHP Version Manager (PVM) is a command-line tool for managing multiple PHP versions on Linux. It allows you to easily install, switch between, and manage different PHP versions required for various projects.
- Install PHP Versions: Easily download, compile, and install different PHP versions.
- Switch PHP Versions: Switch between installed PHP versions.
- List Installed Versions: View all the PHP versions installed on your system.
-
Clone the repository:
git clone https://github.com/your-repo/pvm.git cd pvm
-
Install dependencies:
npm install
-
Build the executable:
npm run build
This will create a binary file named
pvm
-
Move the binary to your local bin directory:
npm run set-path
This will move the
pvm
binary to the/usr/local/bin
directory.
To install a specific PHP version, use the following command:
pvm install <version>
Example:
pvm install 8.0.3
This will download, compile, and install PHP 8.0.3 on your system.
To switch to a specific PHP version:
pvm use <version>
Example:
pvm use 7.4.16
This will set PHP 7.4.16 as the current active version.
To list all the installed PHP versions:
pvm list
This will display all PHP versions installed on your system and indicate the currently active version.
PVM uses a config.json
file to manage default settings, such as the list of extensions to install with each PHP version. The config.json
file is automatically created in the .pvm
directory when you run PVM for the first time. You can modify the default extensions by editing this file.
{
"default-extensions": [
"--with-mysqli",
"--with-pdo-mysql",
"--enable-mbstring",
"--with-openssl",
"--with-curl"
]
}
To uninstall a PHP version, simply remove the directory from the .pvm
folder:
rm -rf ~/.pvm/php-<version>
Feel free to contribute by submitting issues, fork the repository, or send pull requests!
This project is licensed under the MIT License.