ubuntu 下使用 phpbrew 安装php

访问量: 2047

refer to:  https://github.com/phpbrew/phpbrew

如果遇到问题,务必参考官方的文档。  ( 记得安装命令在下面,好长一句: phpbrew install php-5.4.38 +default +mysql +gettext ..... 绝对不要简单的 phpbrew instal php-5.4.38 ... 后面的都忘掉了)

1. $ sudo apt-get update

2. 对于ubuntu 14, 运行下面的命令:

apt-get build-dep php5
apt-get install -y php5 php5-dev php-pear autoconf automake curl build-essential libxslt1-dev re2c libxml2 libxml2-dev php5-cli bison libbz2-dev libreadline-dev
apt-get install -y libfreetype6 libfreetype6-dev libpng12-0 libpng12-dev libjpeg-dev libjpeg8-dev libjpeg8  libgd-dev libgd3 libxpm4 libltdl7 libltdl-dev
apt-get install -y libssl-dev openssl
apt-get install -y gettext libgettextpo-dev libgettextpo0
apt-get install -y libicu-dev
apt-get install -y libmhash-dev libmhash2
apt-get install -y libmcrypt-dev libmcrypt4

2. 对于ubuntu16,运行下面的命令:

apt install \
  php7.0 \
  php7.0-curl \
  php7.0-json \
  php7.0-cgi \
  php7.0-fpm \
  autoconf \
  automake \
  libxml2-dev \
  libcurl4-openssl-dev \
  libssl-dev \
  openssl \
  gettext \
  libicu-dev \
  libmcrypt-dev \
  libmcrypt4 \
  libbz2-dev \
  libreadline-dev \
  build-essential \
  libmhash-dev \
  libmhash2 \
  libxslt1-dev \
  libjpeg-dev  libpng-dev  

3. 安装: 

curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/bin/phpbrew

phpbrew init

4. 向 ~/.bashrc 的末尾增加:

export PHPBREW_SET_PROMPT=1
source /root/.phpbrew/bashrc

5. 使用:   

$ phpbrew known  # 列出所有的版本

# ubuntu 14, 12下:  
$ phpbrew install php-5.4.38 +default +mysql +gettext +mcrypt +intl +iconv +ftp +curl +hash +zlib +gd +openssl +soap +apxs2=/usr/bin/apxs2 -- --with-libdir=lib/x86_64-linux-gnu --with-gd=shared --enable-gd-native-tff --with-jpeg-dir=/usr --with-png-dir=/usr --enable-wddx --with-mysql-sock=/var/run/mysqld/mysqld.sock

# ubuntu 16  下:   (去掉了 aspx, apache下的组件 ) 
$ phpbrew install php-5.4.38 +default +mysql +gettext +mcrypt +intl +iconv +ftp +curl +hash +zlib +gd +openssl +soap  -- --with-libdir=lib/x86_64-linux-gnu --with-gd=shared --enable-gd-native-tff --with-jpeg-dir=/usr --with-png-dir=/usr --enable-wddx --with-mysql-sock=/var/run/mysqld/mysqld.sock

$ phpbrew install 5.4.1
$ phpbrew use 5.4.1  # 使用
$ phpbrew list # 列出安装的版本
$ phpbrew remove php-5.4.45   # 删掉某个版本

订阅/RSS Feed

Subscribe

分类/category