Phalcon needs PHP to run. Its loosely coupled design allows developers to install Phalcon and use its functionality without additional extensions. Certain components have dependencies to other extensions. For instance using database connectivity will require the php_pdo extension. If your RDBMS is MySql/MariaDb or Aurora databases you will need the php_mysqlnd extension also. Similarly, using a PostgreSql database with Phalcon requires the php_pgsql extension.
Hardware
Phalcon is designed to use as little resources as possible, while offering high performance. Although we have tested Phalcon in various low end environments, (such as 0.25GB RAM, 0.5 CPU), the hardware that you will choose will depend on the your application needs.
Our website and blog (as well as other sites) are hosted on an Amazon VM with 512MB RAM and 1 vCPU.
Software
- PHP >= 5.5
Phalcon need the following extensions to run (minimal):
curlgettextgd2(to use thePhalcon\Image\Adapter\Gdclass)libpcre3-dev(Debian/Ubuntu),pcre-devel(CentOS),pcre(macOS)jsonmbstringpdo_*fileinfoopenssl
Optional depending on the needs of your application
- PDO Extension as well as the relevant RDBMS specific extension (i.e. MySQL, PostgreSql etc.)
- OpenSSL Extension
- Mbstring Extension
- Memcache, Memcached or other relevant cache adapters depending on your usage of cache
Installation
Since Phalcon is compiled as a PHP extension, its installation is somewhat different than any other traditional PHP framework. Phalcon needs to be installed and loaded as a module on your web server.
Linux
To install Phalcon on Linux, you will need to add our repository in your distribution and then install it.
DEB based distributions (Debian, Ubuntu, etc.)
Repository installation
Add the repository to your distribution:
Stable releases
curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | sudo bashor
Nightly releases
curl -s https://packagecloud.io/install/repositories/phalcon/nightly/script.deb.sh | sudo bashPhalcon installation
To install Phalcon you need to issue the following commands in your terminal:
PHP 5.x
sudo apt-get update
sudo apt-get install php5-phalconPHP 7
sudo apt-get update
sudo apt-get install php7.0-phalconAdditional PPAs
Ondřej Surý
If you do not wish to use our repository at packagecloud.io, you can always use the one offered by Ondřej Surý.
Installation of the repo:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get updateand Phalcon:
sudo apt-get install php-phalconRPM based distributions (CentOS, Fedora, etc.)
Repository installation
Add the repository to your distribution:
Stable releases
curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.rpm.sh | sudo bashor
Nightly releases
curl -s https://packagecloud.io/install/repositories/phalcon/nightly/script.rpm.sh | sudo bashPhalcon installation
To install Phalcon you need to issue the following commands in your terminal:
PHP 5.x
sudo yum update
sudo yum install php56u-phalconPHP 7
sudo yum update
sudo yum install php70u-phalconAdditional RPMs
Remi
Remi Collet maintains an excellent repository for RPM based installations. You can find instructions on how to enable it for your distribution here.
Installing Phalcon after that is as easy as:
yum install php56-php-phalcon3Additional versions are available both architecture specific (x86/x64) as well as PHP specific (5.5, 5.6, 7.x)
FreeBSD
A port is available for FreeBSD. To install it you will need to issue the following commands:
pkg_add
pkg_add -r phalconSource
export CFLAGS="-O2 --fvisibility=hidden"
cd /usr/ports/www/phalcon
make install cleanGentoo
An overlay for installing Phalcon can be found here https://github.com/smoke/phalcon-gentoo-overlay
macOS
On a macOS system you can compile and install the extension with brew, macports or the source code:
Requirements
- PHP 5.5.x/5.6.x/7.0.x/7.1.x development resources
- XCode
Brew
As the homebrew/php tap has been deprecated and is in the process of being removed, A custom repository for Phalcon has been created.
PHP 5.5 has not been ported to homebrew/core and as such no longer exists. PHP 7.2 on the other hand has been added.
brew tap tigerstrikemedia/homebrew-phalconphp
brew install php56-phalcon
brew install php70-phalcon
brew install php71-phalcon
brew install php72-phalconMacPorts
sudo port install php55-phalcon
sudo port install php56-phalconEdit your php.ini file and then append at the end:
extension=php_phalcon.soRestart your webserver.
Windows
To use Phalcon on Windows, you will need to install the phalcon.dll. We have compiled several DLLs depending on the target platform. The DLLs can be found in our download page.
Identify your PHP installation as well as architecture. If you download the wrong DLL, Phalcon will not work. phpinfo() contains this information. In the example below, we will need the NTS version of the DLL:

The available DLLs are:
| Architecture | Version | Type |
|---|---|---|
| x64 | 7.x | Thread safe |
| x64 | 7.x | Non Thread safe (NTS) |
| x86 | 7.x | Thread safe |
| x86 | 7.x | Non Thread safe (NTS) |
| x64 | 5.6 | Thread safe |
| x64 | 5.6 | Non Thread safe (NTS) |
| x86 | 5.6 | Thread safe |
| x86 | 5.6 | Non Thread safe (NTS) |
| x64 | 5.5 | Thread safe |
| x64 | 5.5 | Non Thread safe (NTS) |
| x86 | 5.5 | Thread safe |
| x86 | 5.5 | Non Thread safe (NTS) |
Edit your php.ini file and then append at the end:
extension=php_phalcon.dllRestart your webserver.
Compile from Sources
Compiling from source is similar to most environments (Linux/macOS).
Requirements
- PHP 5.5.x/5.6.x/7.0.x/7.1.x development resources
- GCC compiler (Linux/Solaris/FreeBSD) or Xcode (macOS)
- re2c >= 0.13
- libpcre-dev
You can install these packages in your system with the relevant package manager. Instructions for popular linux distributions are below:
Ubuntu
sudo apt-get install php5-dev libpcre3-dev gcc makeSuse
sudo zypper install php5-devel gcc makeCentOS/Fedora/RHEL
sudo yum install php-devel pcre-devel gcc makeCompile Phalcon
We first need to clone Phalcon from the GitHub repository
git clone https://github.com/phalcon/cphalconand now build the extension
cd cphalcon/build
sudo ./installYou will now need to add extension=phalcon.so to your PHP ini and restart your web server, so as to load the extension.
# Suse: Add a file called phalcon.ini in /etc/php5/conf.d/ with this content:
extension=phalcon.so
# CentOS/RedHat/Fedora: Add a file called phalcon.ini in /etc/php.d/ with this content:
extension=phalcon.so
# Ubuntu/Debian with apache2: Add a file called 30-phalcon.ini in /etc/php5/apache2/conf.d/ with this content:
extension=phalcon.so
# Ubuntu/Debian with php5-fpm: Add a file called 30-phalcon.ini in /etc/php5/fpm/conf.d/ with this content:
extension=phalcon.so
# Ubuntu/Debian with php5-cli: Add a file called 30-phalcon.ini in /etc/php5/cli/conf.d/ with this content:
extension=phalcon.soAdvanced Compilation
Phalcon automatically detects your architecture, however, you can force the compilation for a specific architecture:
cd cphalcon/build
# One of the following:
sudo ./install --arch 32bits
sudo ./install --arch 64bits
sudo ./install --arch safeIf the automatic installer fails you can build the extension manually:
git clone https://github.com/phalcon/cphalcon
# cd cphalcon/build/php5/32bits
cd cphalcon/build/php5/64bits
# NOTE: for PHP 7 you have to use
# cd cphalcon/build/php7/32bits
# or
# cd cphalcon/build/php7/64bits
make clean
phpize --clean
export CFLAGS="-O2 --fvisibility=hidden"
./configure --enable-phalcon
make
make installIf you have specific php versions running:
git clone https://github.com/phalcon/cphalcon
# cd cphalcon/build/php5/32bits
cd cphalcon/build/php5/64bits
# NOTE: for PHP 7 you have to use
# cd cphalcon/build/php7/32bits
# or
# cd cphalcon/build/php7/64bits
make clean
/opt/php-5.6.15/bin/phpize --clean
export CFLAGS="-O2 --fvisibility=hidden"
./configure --with-php-config=/opt/php-5.6.15/bin/php-config --enable-phalcon
make
make installYou will now need to add extension=phalcon.so to your PHP ini and restart your web server, so as to load the extension.
You can create a small script in your web server root that has the following in it:
<?php
phpinfo();and load it on your web browser. There should be a section for Phalcon. If there is not, make sure that your extension has been compiled properly, that you made the necessary changes to your php.ini and also that you have restarted your web server.
You can also check your installation from the command line:
php -r 'print_r(get_loaded_extensions());'This will output something similar to this:
Array
(
[0] => Core
[1] => libxml
[2] => filter
[3] => SPL
[4] => standard
[5] => phalcon
[6] => pdo_mysql
)You can also see the modules installed using the CLI:
php -m