Install two different versions os Phalcon in the same server

I have an application with version 2.0.10 and another one with 3.1.2 . Phalcon versions are completely imcompatible. They are running in differente servers and there are no budget to upgrade the code to a newer version.

Is it possible to run both in the same server? Maybe using different php (php5 for older)?

If you can run them on different PHP versions, it's easy to do so.

After installing the two PHP versions, compile the two cphalcon versions from source:

git clone git://
git checkout tags/phalcon-v2.0.13
cd cphalcon/build/64bits
export CFLAGS="-O2 --fvisibility=hidden"
./configure --with-php-config=<php5 php-config executable> --enable-phalcon
make && sudo make install
git clone git://
git checkout tags/v3.4.1
cd cphalcon/build/php7/64bits
export CFLAGS="-O2 --fvisibility=hidden"
./configure --with-php-config=<php7 php-config executable> --enable-phalcon
make && sudo make install

Then don't forgent to enable the extension in the respective php.ini files

edited Oct '18

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 = and in another pool extension = where you had compiled both versions and ranamed them like that.

Check out my example:

[email protected]:/usr/lib/php/20151012# file ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=60b8f210d68f708d4f0621508259a55ca82ef23c, stripped

thus I'm loading extension = 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Ă .