What is Phalcon?
Phalcon is a PHP MVC Framework written with speed in mind; however, it takes a different approach to getting that speed. Quite a few micro-frameworks exist, the popular contenders being Slim, Silex, and CodeIgniter, but they all are exactly that: a micro-framework. Thus, you’re missing a lot of built-in functionality found in bigger, more feature-packed MVC Frameworks like Laravel, FuelPHP, and Symphony.
Phalcon PHP aims to bridge that gap, providing an extremely fast, yet still robust framework. This probably leaves you wondering “How does it possibly do that?”
Phalcon is a C Extension to the PHP language, so you compile it as a module for PHP and thus all the classes you would use are compiled into PHP, rather than interpreted, like pretty much every other PHP Framework. The speed gains by doing this are absolutely unbelievable; even though this framework can go toe-to-toe in features with other libraries like Laravel and FuelPHP, it still beats the micro-frameworks in speed! Check out these benchmarks for proof.
How Do I Install Phalcon?
As Phalcon is a PHP Module, you install this much the same way as you would something like APCu or XCache—by downloading source files, compiling them and then adding that module to PHP’s configuration.
Assuming that you use Debian-flavored Linux, here are some instructions – otherwise, check out the link after this section for installation instructions specific to your OS.
sudo apt-add-repository ppa:phalcon/stable sudo apt-get update sudo apt-get install php5-phalcon
However, if you prefer to build from source instead of rely on a PPA, here’s how you can download & install Phalcon PHP.
Compilation Instructions (From Phalcon’s Website)
#Ubuntu sudo apt-get install php5-dev php5-mysql gcc libpcre3-dev #Fedora sudo yum install php-devel php-mysqlnd gcc libtool #RHEL sudo yum install php-devel php-mysql gcc libtool #Suse yast2 -i php5-pear php5-devel php5-mysql gcc
First, you need to make sure that you have the development libraries that Phalcon relies on, so take the line from above that applies to your configuration.
Then, we need to clone the Git Repository for Phalcon.
git clone --depth=1 git://github.com/phalcon/cphalcon.git cd cphalcon/build sudo ./install
This will build and install the Phalcon C Extension, so the next-to-last last thing we need to do is add the extension to your php.ini by adding this line:
extension=phalcon.so. Finally, restart your server so that PHP now knows about the Phalcon extension.
service apache2 restart
If the above didn’t work for you, or you use something other than Linux, check out the following link for full instructions!