PHP
Environments
why ?
multiple elephants

https://www.flickr.com/photos/doug88888/8689222557
History
rbenv

https://www.flickr.com/photos/dragon_fire4/11472715343
Ruby Version Management Tool
Meet phpenv

https://www.flickr.com/photos/freedom-to-move/11640726394
manage multiple versions of same release
easy switch between versions
can be used to install php versions
$ git clone git://github.com/phpenv/phpenv.git .phpenv
$ echo 'export PATH="$HOME/.phpenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(phpenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile
$ phpenv rehash
README.md
$ git clone git://github.com/phpenv/phpenv.git .phpenv
$ echo 'export PATH="$HOME/.phpenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(phpenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile
$ phpenv rehash
README.md
$ git clone git://github.com/phpenv/phpenv.git .phpenv
$ echo 'export PATH="$HOME/.phpenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(phpenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile
$ phpenv rehash
README.md
$ phpenv versions
List installed versions
$ phpenv versions
phpenv v0.0.4-dev
* system
List installed versions
OUPS
Installation

https://www.flickr.com/photos/55518903@N04/5146621287/
build from source
php-build
build from source
messy
lot to setup
download
different commands
integrate with phpenv
build from source
BUT
it should work eventually
php-build
builds php from source
automatically
can be used as phpenv module
$ git clone git://github.com/CHH/php-build.git
$ cd php-build
$ ./install.sh
README.md
OR
$ git clone git://github.com/CHH/php-build.git
$ cd php-build
$ ./install.sh
$ git clone git://github.com/CHH/php-build.git
$HOME/.phpenv/plugins/php-build
$ phpenv install <definition>
README.md
OR
$ php-build --definitions
5.2.17
5.3.10
5.3.11
...
$ php-build 5.2.17 ~/.phpenv/versions/5.2.17
Install
still need PHP build dependencies
$ sudo apt-get build-dep php5-cli
Switch versions
$ phpenv global 5.2.17
$ phpenv local 5.2.17
$ phpenv shell 5.2.17
$ export PHPENV_VERSION=5.2.17
The magic

https://www.flickr.com/photos/bhala/16304798498
phpbrew

https://www.flickr.com/photos/carlagomez/10851469535
$ curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
$ chmod +x phpbrew
$ sudo mv phpbrew /usr/bin/phpbrew
$ phpbrew init
$ echo "source $HOME/.phpbrew/bashrc" >> ~/.bashrc
README.md
$ phpbrew known
5.6: 5.6.6, 5.6.5, 5.6.4, 5.6.3, 5.6.2, 5.6.1, 5.6.0 ...
5.5: 5.5.22, 5.5.20, 5.5.19, 5.5.18, 5.5.17, 5.5.16, 5.5.15
...
$ phpbrew install 5.6.6
$ phpbrew install 5.6.6 +sqlite
Installation
$ phpbrew use php-5.6.6
$ phpbrew switch php-5.6.6
$ phpbrew off
Switch versions

PHP-FPM
PHP FastCGI Process Manager

Multiple paralel elephants
Multiple paralel elephants


app53.php->9000 nginx app.php->9001
php-fpm
php-fpm
9000
9001
app53.php app.php

QUESTIONS
THANK YOU
References
http://www.ondrejsimek.com/blog/running-multiple-php-versions-is-so-easy-with-fastcgi/
http://mile23.com/content/using-phpenv-and-php-build-your-ubuntu
http://www.sitepoint.com/use-phpbrew-virtphp/
https://github.com/phpbrew/phpbrew
https://github.com/phpenv/phpenv
https://github.com/CHH/php-build
PHP Environments
By lenardpalko
PHP Environments
- 1,108