安装php多版本管理工具phpenv

1. Install phpenv

Install phpenv

git clone https://github.com/madumlao/phpenv.git ~/.phpenv

Install php-buildto build php

git clone https://github.com/php-build/php-build.git ~/.phpenv/plugins/php-build

Add the following to .bash_profile

# phpenv
export PATH="/usr/local/opt/bison/bin:$PATH"
export PHPENV_ROOT="$HOME/.phpenv"
export PATH="$PHPENV_ROOT/bin:$PATH"
eval "$(phpenv init -)"

Load .bash_profilein shell

source .bash_profile

2. How to Use phpenv ( Install and manage PHP )

How to check which version you can use.

 phpenv install -l

How to check which version you insatlled.

phpenv versions

How to install the specified version of PHP.

phpenv install 7.4.8

Run this command after you install a new version of PHP

phpenv rehash

How to use the specified version of PHP at global.

 phpenv global 7.4.8

How to use the specified version of PHP at local ( directory ).

phpenv local 7.4.8

This command will create .php-versionfile at current directory.

3. How to use composer

Install composer to phpenv

git clone https://github.com/ngyuki/phpenv-composer.git ~/.phpenv/plugins/phpenv-composer
phpenv rehash

4. How to Update phpenv

cd $(phpenv root)
git pull

5. How to Update php-build

When a new version of PHP is released, you need to update php-build. Otherwise you can not install the new version of PHP.

cd $(phpenv root)/plugins/php-build
git pull
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值