PHP Web Development: Introducing Vagrant
June 8, 2015
Day by day, PHP is becoming popular and we can see several young professionals willing to make career in this field. For such newbies, we recommend to make use of some beginner’s resources to know PHP completely.
Recently, PHP has come up with new Vagrant Development. So, for now newbies; before learning PHP it’s important to be aware about this latest development process. Today, in this blog post we will discuss briefly about this new web development process.
So, let’s begin….
What is Vagrant Development?
To understand Vagrant properly, first of all we must understand properly certain terms i.e. Virtual Machine, Virtual Box and Provisioning.
- Virtual Machine: It’s a separate part of the main computer that believes to be itself as a computer. Let’s understand this with example.
Suppose, we have a CPU with 3 core processor, 8GB RAM, 500 GB hard drive space then from this we can easily convert 1 core, 2 GBRAM and nearly about 20GB hard drive space into VM.
Once this much space is transformed into a VM then it considers itself as a computer and becomes unaware of the parent system. This means by transforming some part of memory into a Virtual machine, you are actually creating a computer inside a computer.
This means in case your system is caught by a virus then only this VM will be affected, the computer will remain safe. Yes, creating a VM will slow down your computer but once you shut it down then the memory is freed from it.
Remember you are not shutting down your main PC only the VM. VM is developed for a specific purpose and once that purpose is achieved, it can be physically shut down. In order to create this VM, there’s a need to develop Virtual Box and this is as follows:
- Virtual Box: With this virtual box, one can easily and quickly create virtual machines. It provides easy to use graphical interface that is used to configure several virtual machines and it helps you to choose the amount of your computer memory that you wish to transform into virtual machine.
For this, one needs an existing image, let’s say an installation CD. If you wish to create a VM for Windows then you must keep Windows installation DVD handy.
- Provisioning: Once VM is developed, then it’s time to configure it in the same way we are doing in a new computer. This task is time consuming. Provisioning is a way to reduce the time taken in this task.
After creating the VM, launch the provisioner and then everything will be done on its own.
So, now comes the time to know about Vagrant. Vagrant integrates Provisioner and virtual box to configure VM. Vagrant machines don’t contain any graphical elements, windows or taskbars.
Vagrant Virtual Machine for PHP development:
Why vagrant virtual machine is recommended for PHP development in particular? Reasons are as follows:
Ability to test on different PHP versions or PHP installed with extensions. The code can be tested on every extension without reinstalling anything. Just make sure that your code is cross version compatible.
- Ability to test on various servers. For instance, in one VM you can test on Apatche, in another test on Lightpd and so on. Just ensure that the code is server compatible.
- Mark the code execution speed on various server combinations. It is possible that the code is executed quickly on one server as compared to other. Thus, further optimizing and alerting potential users to different speed gains.
- This can be shared with other team members as well so that no one can make excuse that “it doesn’t work on my system”. Just simply share the setup file with everyone and the setup will be available to them.
Apart from this there are several other reasons that prove that Vagrant development is highly recommended instead of XAMPP even though the later on is a complete package of PHP, Apache and MYSQL.
Wind Up
So, from now on make sure to adopt Vagrant development with PHP. If you need further guidance, then get in touch with Softqube Technologies, well known PHP development company in India.
Share on