As a developer, you will have your own environment with which you need to feel confident enough, and which can actually help you writing the code without many worries. If you do feel that there's a gap between writing the code and seeing the actual result, then there's something you need to fix.
It's quite important for the purpose of this book to outline my optimal environment that I will use throughout the upcoming chapters and code samples that you will find.
I will, of course, note when the environment might make a difference, but be wary that, if your environment is different, you may need to check the developer's documentation or reach out to anyone who might know the answer, in case something is not working.
My personal development environment is composed of the following:
A development or testing environment is usually quite simple to set up as it won't require an extensive configuration, as it would do in a critical or production environment.
One of the reasons in favor of having such an environment setup, in particular with reference to the LAMP box, is the ability to configure it as you wish based on the project you're working on, and in particular being able to replicate the live/production environment as close as possible. This has a clear advantage when it comes to the following:
Vagrant is probably the tool you're looking for if you want to start easy (see http://www.vagrantup.com/), and if it convinces you, it might be worth giving the book, Creating Development Environments with Vagrant, Michael Peacock, Packt Publishing, a shot (http://www.packtpub.com/creating-development-environments-with-vagrant/book).
PHP does not need major adjustments, and I believe a default PHP installation will suffice to get you started as this is the only constraint for running Yii 2. Be sure to have a version equal to or above 5.4, and have a CLI PHP available on the command line, by issuing the following command:
$ php –v PHP 5.5.22-1+deb.sury.org~precise+1 (cli) (built: Feb 20 2015 11:25:06) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
The preceding output is from a Vagrant machine running Ubuntu 12.04 with PHP 5.5 installed.
The dollar sign ($
) means the command can be run by a user and you won't need administrative permissions to run it.
If you get a command not found
error, be sure to refer to your distribution/OS vendor for support on how to install it. Most of the distributions provide it by default, while others require additional configuration parameters or packages.