So, these were few points justifying the needs of detailed testing before every release to provide or maintain quality of a software regularly. Testing is important, but it needs to be done in a smart and efficient way otherwise it will become the most cumbersome bottleneck before every release.
In this blog I intend to compare a traditional technique of PHP testing with our developed “PHP test server technique”. I hope it will prove efficient as well as effective for everyone. It will allow to-
- Test your applications with Multiple php version in just a second. What’s better than this ☺
- Moreover, its open source and free to use.
Conventional way to test with multiple PHP versions.
Testing your Applications with separate Hardware Machines
A developer will be well aware that every testing machine can be allotted only a unique PHP version and a server. So, the most outdated and obvious way is to create many machines or servers and each containing its own PHP versions but that would require a lot of hardware indirectly affecting your cost as well as requiring ton of hard work to recreate the issues in different versions separately.
This is the most outdated method and strictly not recommended to use for testing purposes.
Testing your Application with SIngle Hardware Machine using different virtual machines in it:
Next evolvement in the testing scenario was the advent of virtual machines and vagrant which allowed the users to create a whole new environment, complete with the choice of Operating System within a single PC.
This techniques has an advantage that allows the users to create different environment using virtual machine within a single PC but it has few cons such as :
- The system should be capable to sustain such heavy processing.
- Recreating the issues in different virtual machine requires persistence.
- Very time consuming process as the database and source code has to be synchronized separately in all the machines.
- All the virtual machines need to be maintained and designed separately.
A new way to test with multiple PHP versions.
What we did exactly, was to create a new flow using the existing technology of Fast CGI.
How does the PHP test server works?
Unlike the above two methods a user doesn’t require to maintain multiple virtual systems and overload the system. Instead the user will just need to setup
- A single virtual machine complete with vagrant.
- Share the php source code with vagrant.
The basic fundamental behind the complete working of this model tells that -
- We have tried to break the hard binding of a server (Apache) with its PHP versions.
- Now whenever the server is triggered the Fast CGI Module comes into play.
- Fast CGI Module determines the required PHP version by a user.
- Then serves the desired PHP environment for the testing.
- Now you can test your single database with different php versions.
- You can easily test your php version using test.php file. Refer repo for detail
- Just type your required php version server in url and its works
The complete process allows you to maintain a single database of your testing site and implement different PHP versions on it. This will make the switching of PHP versions just a matter of typing a url with desired PHP version.
How to setup the process on your end?
Above was the complete workflow of the process. If you wish to set up this process at your end and simplify the testing process you are heartly welcome to use our Github repo and contribute in it. The Github repository contains the complete usage guidance for your convenience.