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

Michelle 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>
<IfModule mod_fcgid.c>
Action    php-fcgi    /fcgi-bin/phpcgi-starter-5.4
</IfModule>

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 answer on Server Fault.

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