Requirements

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

You should always try and use the latest version of Phalcon and PHP as both address bugs, security enhancements as well as performance. PHP 5.5 will be deprecated in the near future, and Phalcon 4 will only support PHP 7

MacPorts

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

Wersja

Typ

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.dll

Restart 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 make

Suse

sudo zypper install php5-devel gcc make

CentOS/Fedora/RHEL

sudo yum install php-devel pcre-devel gcc make

Compile Phalcon

We first need to clone Phalcon from the Github repository

git clone https://github.com/phalcon/cphalcon

and now build the extension

cd cphalcon/build
sudo ./install

You 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.so

Advanced Compilation

Phalcon automatically detects your architecture, however, you can force the compilation for a specific architecture:

You 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:

<?phpphpinfo();

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.

Note that in some Linux based systems, you might need to change two php.ini files, one for your web server (Apache/Nginx), and one for the CLI. If Phalcon is loaded only for say the web server, you will need to locate the CLI php.ini and make the necessary additions for the module to be loaded.