当前位置: 首页 > 工具软件 > PHPBrew > 使用案例 >

PHPBrew安装配置

韩经武
2023-12-01

apt update -y
apt upgrade -y
dpkg --configure -a

# 安装依赖

sudo apt install -y build-essential libbz2-dev libreadline-dev libsqlite3-dev \
libcurl4-gnutls-dev libzip-dev libssl-dev libxml2-dev libxslt-dev \
php7.2-cli php7.2-bz2 pkg-config libcurl4-openssl-dev libonig-dev libedit-dev

sudo apt-get install curl libcurl4-gnutls-devcurl -L -O https://github.com/phpbrew/phpbrew/releases/latest/download/phpbrew.phar
chmod +x phpbrew.phar

# Move the file to some directory within your $PATH
 

sudo mv phpbrew.phar /usr/local/bin/phpbrew

phpbrew init


#接着在 .bashrc 或 .zshrc 文件增加如下行:

vim  ~/.bashrc
[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc

#支持macports,homebrew,debian,ubuntu

phpbrew lookup-prefix ubuntu

phpbrew known
phpbrew update --old

phpbrew install php-5.6.40 +default +mysql +pdo +mbstring +fpm +curl -intl -openssl
phpbrew install php-7.2.34 +default +mysql +pdo +mbstring +fpm +curl -intl -openssl

phpbrew list
phpbrew use 5.6.40


## 报错处理

1、no package ‘oniguruma’ found
  apt install libonig-dev

2、configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/
# RetHat CentOS or Fedora 使用下面安装命令
sudo yum install curl curl-devel -y
# Debian or Ubuntu使用下面的安装命令
sudo apt install curl  libcurl4-gnutls-dev -y
cd /usr/local/include && sudo ln -s /usr/include/x86_64-linux-gnu/curl


##Nginx如何切换多版本?

#需要重启 php-fpm 才能生效
#关闭系统之前的fpm
vim ~/.phpbrew/php/php-5.6.40/etc/php-fpm.conf 
#修改权限,将 user 和 group行注释掉,改为:
;user = nobody
;group = nobody
#将 listen 行改为监听端口
listen = 127.0.0.1:9000
#重启phpbrew的fpm
phpbrew fpm stop
phpbrew switch 5.6.40
phpbrew fpm start

 类似资料: