How To Install Phalcon Version 2

The Phalcon PHP framework is a high-performance PHP web framework based on the model–view–controller (MVC) pattern. Originally released in 2012, it is an open-source framework licensed under the terms of the BSD License.

Unlike most PHP frameworks, Phalcon is implemented as a web server extension written in Zephir and C, aiming to boost execution speed, reduce resource usage, and handle more HTTP requests per second than comparable frameworks written primarily in PHP.

Source — Wikipedia

Phalcon Logo — Source:

Version 3.0.0 final (LTS) was released on the 29th of July, 2016 and version 3.0.1 was released on the 24th of August, 2016.

Since the release of version 3, new Phalcon installations now default to version 3.0.1, this is a good thing if you don’t have existing projects built on phalcon, however if you do this could be bad.

Why do I need to install version 2?

Phalcon now follows Semantic Versioning (MAJOR.MINOR.PATCH) existing applications might break as the new release is a MAJOR version that makes incompatible API changes.

I ran into this issue lately and I searched through the web but I could not find any resource to help install version 2.0.x. However I was able to find a solution by compiling Phalcon from source, so I thought to share.

Installing 2.0.x

Code snippet to install phalcon 2.0.x

This code snippet builds Phalcon from source and creates a file. Line 4 clones the cphalcon repo from github, line 5 changes the branch tracked by the origin to 2.0.x. Line 6 fetches the 2.0.x branch and line 7 switches the current branch to 2.0.x. Line 8 changes directory into the build folder in the cloned cphalcon repository and finally line 9 builds the Phalcon extension.

To enable Phalcon, add the code below to your php.ini file or a specific .ini file (ext-phalcon.ini).


You would need to restart your webserver to effect the changes.

To confirm that the Phalcon extension is enabled on CLI, run the command below.

php -i | grep phalcon

You should see a summary as show below.

Phalcon installation confirmation on CLI

To confirm that it’s available for your webserver, create a php file and add the snippet below.


Navigating to the php file in your browser, you should see the Phalcon section as shown below.

Phalcon installation confirmation for webservers

Questions? Comments?, please drop your thoughts in the comments section or shoot me a mail at Don’t forget to hit the recommend 💚 button if you found this article useful and feel free to share with your network. 🙂