phpenv: Simple PHP Version Management
phpenv is a tool that allows you to install and switch between PHP versions easily. It’s ideal for simpler, PHP-only projects.
How to Install phpenv:
- Clone the phpenv repository:
git clone https://github.com/phpenv/phpenv.git ~/.phpenv- Add phpenv to your path (e.g., in
/.bash_profileor~/.zsh_rc):
export PATH="$HOME/.phpenv/bin:$PATH"
eval "$(phpenv init -)"- Install php-build plugin:
git clone https://github.com/php-build/php-build.git ~/.phpenv/plugins/php-build- Install a specific PHP version:
phpenv install 7.4.1- Switch PHP versions globally, per directory, or for the current shell:
phpenv global 7.4.1
phpenv local 7.4.1
phpenv shell 7.4.1