virtPHP - How it works and Live demo
What Is virtPHP?
virtPHP is a tool for creating and managing multiple isolated PHP environments on a single machine. It's like Python's virtualenv, but for PHP.
virtPHP creates isolated environments so that you may run any number of PHP development projects, all using different versions of PEAR packages and different PECL extensions. You may even specify a different version of PHP, if your system has various installations of PHP.
To install multiple versions of PHP, we suggest taking a look at the phpenv and php-build projects and using virtPHP with them, to manage multiple virtual PHP environments.
Note: virtPHP is currently only targeted to command line php (php-cli) for *nix based systems.
Installation
Download the virtphp.phar file from the latest release and place it in /usr/local/bin or wherever it's accessible from your PATH.
Optionally, you may clone this repository and build the phar file yourself.
Usage
virtPHP is a command-line tool. To get started, you'll probably want to check out what it can do. To do this, just execute it without any arguments, like this:
php virtphp.phar
If you have the phar file set executable (i.e. chmod 755), then you can execute it like this:
./virtphp.phar
Or, if it's in your PATH, like this:
virtphp.phar
We recommend putting it in your PATH and aliasing it to virtphp, so that you can run it like this:
virtphp
For convenience, the following examples will assume you have simply downloaded virtphp.phar and have not placed it in your PATH or set it executable.