Switching b/w versions of PHP on a NginX + PHP-FPM Setup

Jürgen Paul asked:

On Apache you could easily configure it through an htaccess file:

<IfModule mod_fcgid.c>
Action    php-fcgi    /fcgi-bin/phpcgi-starter-5.3
<IfModule mod_fcgid.c>
Action    php-fcgi    /fcgi-bin/phpcgi-starter-5.4

Is there something similar for Nginx + PHP-FPM?

My answer:

Just run each version of php-fpm on a different port (or socket) and configure the appropriate port in your fastcgi_pass parameter in your nginx server block. For instance, you might have 5.3 run on port 9000 and 5.4 run on port 9001.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.