I hope you're using PHP-FPM.
; Additional php.ini defines, specific to this pool of workers. These settings
; overwrite the values previously defined in the php.ini. The directives are the
; same as the PHP SAPI:
; php_value/php_flag - you can set classic ini defines which can
; be overwritten from PHP call 'ini_set'.
; php_admin_value/php_admin_flag - these directives won't be overwritten by
; PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
; Defining 'extension' will load the corresponding shared extension from
; extension_dir.
then just add per pool:
extension = phalcon3.so
and in another pool extension = phalcon2.so
where you had compiled both versions and ranamed them like that.
Check out my example:
[email protected]:/usr/lib/php/20151012# file phalcon341.so
phalcon341.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=60b8f210d68f708d4f0621508259a55ca82ef23c, stripped
thus I'm loading extension = phalcon341.so
in one pool, whilst in another pool I used to have 2.0.x for a legacy project.
Bottomline: frankly nowdays when there are so easier ways to acomplish this separation - I wouldn't recommend this unless you're really good with Linux services - I'd rather fire up an LXD machine container for each Phalcon version/environment and voilĂ .