I watched a gist on github explains how run multiple versions of php on ubuntu 14.04 with apache.
but how can we get the same result with nginx?
Take a look at this website i think it is what you want. How to Run Multiple Versions of PHP on One Server
In case if you are using Nginx Server:
If your different applications are in different folders,
You can try writing nested location tags and write your php configuration based on that.
For example if a sub folder having an application that needs a php 5.6 version and your root application need a php version that needs php 5.5 version then on your nginx configuration inside the location stanza of your application(say app1) put your copy and paste php execution related stanza relevant to your app.
example
server{
location app1{
location ~ \.php$ {
...
fastcgi_pass 127.0.0.1:9001;
..
}
}
location ~ \.php$ {
...
fastcgi_pass 127.0.0.1:9000;
..
}
}
You have to install multiple php versions and configure its fpm conf to match the port address