<commit_before>PHPBrew
==========

phpbrew builds and installs multiple version php(s) in your $HOME directory.

phpbrew also manage the environment variables, so you can `use`, `switch` php
version whenever you need.

phpbrew can:

- build php with different variants like PDO, mysql, sqlite, debug ...etc.
- compile apache php module and seperate them by different versions.
- build and install php(s) in your home directory, so you don't need root permission.
- switch versions very easily and is integrated with bash/zsh shell.
- automatic feature detection.

<img width="600" src="https://raw.github.com/c9s/phpbrew/master/screenshots/01.png"/>

<img width="600" src="https://raw.github.com/c9s/phpbrew/master/screenshots/03.png"/>


## Platform support

* Mac OS 10.5+
* Ubuntu, Debian

## Requirement

* PHP5.3
* curl
* gcc, binutil, autoconf, libxml, zlib, readline

### Mac OS X Requirement

MacPorts users:

```bash
port install curl automake autoconf $(port echo depof:php5)
```

HomeBrew users:

```bash
brew install automake autoconf curl pcre mhash glibtool

# incomplete
```

### Ubuntu/Debian Requirement

```bash
sudo apt-get install autoconf automake curl build-essential libxslt1-dev libtidy-dev re2c
sudo apt-get build-dep php5 
```

### Cent OS Requirement

Cent OS requirement setup

```bash
sudo rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm

# If you don't have php
sudo yum install --enablerepo=webtatic php php-xml libtidy
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
sudo rpm -Uvh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
sudo yum install --enablerepo=rpmforge re2c libmhash
```

Reference: http://matome.naver.jp/odai/2133887830324055901

## Install phpbrew

Just download it:

```bash
curl -O https://raw.github.com/c9s/phpbrew/master/phpbrew
chmod +x phpbrew
sudo cp phpbrew /usr/bin/phpbrew
```

## Basic usage

Init a bash script for your shell environment:

```bash
$ phpbrew init
```

Then add these lines to your `.bashrc` or `.zshrc` file:

```bash
$ source ~/.phpbrew/bashrc
```

To list known versions:

```bash
$ phpbrew known
Available stable versions:
    php-5.3.10
    php-5.3.9
    php-5.3.8
    php-5.3.7
Available svn versions:
    php-svn-head
    php-svn-5.3
    php-svn-5.4
Available versions from PhpStas:
    php-5.4.0RC1
    php-5.4.0RC2
    ....
    php-5.4.0RC7
    ....
    php-5.4.0alpha3
    php-5.4.0beta2
```


## Build And Install

simply build and install PHP:

```bash
$ phpbrew install php-5.4.0
```

With tests:

```bash
$ phpbrew install --test php-5.4.0
```

With debug messages:

```bash
$ phpbrew -d install --test php-5.4.0
```





## Variants

To list variants:

```bash
$ phpbrew variants

Variants:
    pear
    mysql
    debug
    sqlite
    pgsql
    cli
    apxs2
    cgi
    soap
    pcntl
    ... (etc)
```

You can build PHP with extra variants:

    $ phpbrew install php-5.3.10 +mysql +sqlite +cgi

    $ phpbrew install php-5.3.10 +mysql +debug+mysql+pgsql +apxs2

    $ phpbrew install php-5.3.10 +mysql +mysql +apxs2=/usr/bin/apxs2

PDO is enabled by default.

To build PHP with pgsql (Postgresql) extension:

    $ phpbrew install php-5.4.1 +pgsql

Or build pgsql extension with postgresql base dir:

    $ phpbrew install php-5.4.1 +pgsql=/opt/local/lib/postgresql91 


NOTE:

> 1. If you want to build php with apache php module, please change the permission
> of apache module directory, eg: `/opt/local/apache2/modules/`.  
> it should be writable and phpbrew should be able to change permission.
> after install, you should check your httpd.conf configuration file, to switch 
> your php module version. :-)
> 
> 2. phpbrew currently only supports for apxs2 (apache2)

If you enabled the `apxs2` variant, your apache conf file
might look like this if you have multiple php(s) installed
on your system:
<commit_msg>Remove duplicate 'mysql' in README.md<commit_after>PHPBrew
==========

phpbrew builds and installs multiple version php(s) in your $HOME directory.

phpbrew also manage the environment variables, so you can `use`, `switch` php
version whenever you need.

phpbrew can:

- build php with different variants like PDO, mysql, sqlite, debug ...etc.
- compile apache php module and seperate them by different versions.
- build and install php(s) in your home directory, so you don't need root permission.
- switch versions very easily and is integrated with bash/zsh shell.
- automatic feature detection.

<img width="600" src="https://raw.github.com/c9s/phpbrew/master/screenshots/01.png"/>

<img width="600" src="https://raw.github.com/c9s/phpbrew/master/screenshots/03.png"/>


## Platform support

* Mac OS 10.5+
* Ubuntu, Debian

## Requirement

* PHP5.3
* curl
* gcc, binutil, autoconf, libxml, zlib, readline

### Mac OS X Requirement

MacPorts users:

```bash
port install curl automake autoconf $(port echo depof:php5)
```

HomeBrew users:

```bash
brew install automake autoconf curl pcre mhash glibtool

# incomplete
```

### Ubuntu/Debian Requirement

```bash
sudo apt-get install autoconf automake curl build-essential libxslt1-dev libtidy-dev re2c
sudo apt-get build-dep php5 
```

### Cent OS Requirement

Cent OS requirement setup

```bash
sudo rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm

# If you don't have php
sudo yum install --enablerepo=webtatic php php-xml libtidy
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
sudo rpm -Uvh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
sudo yum install --enablerepo=rpmforge re2c libmhash
```

Reference: http://matome.naver.jp/odai/2133887830324055901

## Install phpbrew

Just download it:

```bash
curl -O https://raw.github.com/c9s/phpbrew/master/phpbrew
chmod +x phpbrew
sudo cp phpbrew /usr/bin/phpbrew
```

## Basic usage

Init a bash script for your shell environment:

```bash
$ phpbrew init
```

Then add these lines to your `.bashrc` or `.zshrc` file:

```bash
$ source ~/.phpbrew/bashrc
```

To list known versions:

```bash
$ phpbrew known
Available stable versions:
    php-5.3.10
    php-5.3.9
    php-5.3.8
    php-5.3.7
Available svn versions:
    php-svn-head
    php-svn-5.3
    php-svn-5.4
Available versions from PhpStas:
    php-5.4.0RC1
    php-5.4.0RC2
    ....
    php-5.4.0RC7
    ....
    php-5.4.0alpha3
    php-5.4.0beta2
```


## Build And Install

simply build and install PHP:

```bash
$ phpbrew install php-5.4.0
```

With tests:

```bash
$ phpbrew install --test php-5.4.0
```

With debug messages:

```bash
$ phpbrew -d install --test php-5.4.0
```





## Variants

To list variants:

```bash
$ phpbrew variants

Variants:
    pear
    mysql
    debug
    sqlite
    pgsql
    cli
    apxs2
    cgi
    soap
    pcntl
    ... (etc)
```

You can build PHP with extra variants:

    $ phpbrew install php-5.3.10 +mysql+sqlite+cgi

    $ phpbrew install php-5.3.10 +mysql+debug+pgsql +apxs2

    $ phpbrew install php-5.3.10 +mysql +pgsql +apxs2=/usr/bin/apxs2

PDO is enabled by default.

To build PHP with pgsql (Postgresql) extension:

    $ phpbrew install php-5.4.1 +pgsql

Or build pgsql extension with postgresql base dir:

    $ phpbrew install php-5.4.1 +pgsql=/opt/local/lib/postgresql91 


NOTE:

> 1. If you want to build php with apache php module, please change the permission
> of apache module directory, eg: `/opt/local/apache2/modules/`.  
> it should be writable and phpbrew should be able to change permission.
> after install, you should check your httpd.conf configuration file, to switch 
> your php module version. :-)
> 
> 2. phpbrew currently only supports for apxs2 (apache2)

If you enabled the `apxs2` variant, your apache conf file
might look like this if you have multiple php(s) installed
on your system:

{'fraction_non_alphanumeric': 0.11700891127469973, 'fraction_numerical': 0.035386800981531706, 'mean_word_length': 3.367738296672307, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2689320', 'n_tokens_mistral': 3088, 'n_tokens_neox': 2731, 'n_words': 867}