How to Install the PHP Phalcon Extension

In the examples shown, replace "X.Y" with your app's PHP version (for example, "7.0").

Phalcon is a PHP web framework implemented as a C extension offering high performance and lower resource consumption.

To use the Phalcon framework, you must first install the Phalcon PHP extension for your version of PHP.

Phalcon currently supports PHP 5.4, 5.5, 5.6, 7.0, 7.1, and 7.2.

Important: Your server must have at least 2 GB of memory to build and install the Phalcon extension. Attempting to install Phalcon on low-memory systems may crash your server!

To install this extension, run the following on your server as root:

sudo apt-get -y install gcc make autoconf libc-dev pkg-config
git clone --depth=1 git://
cd cphalcon/build
sudo PATH=/opt/sp/phpX.Y/bin:$PATH ./install

If the last command above fails and exits with the message gcc: internal compiler error: Killed (program cc1), your server does not have enough memory to install Phalcon.

When the above commands complete successfully, create a configuration file for the extension and restart PHP by running the following command as root:

sudo bash -c "echo > /etc/phpX.Y-sp/conf.d/phalcon.ini"
sudo service phpX.Y-fpm-sp restart

You can verify Phalcon is installed by running this command:

phpX.Y-sp -i | grep phalcon

If Phalcon is installed correctly, you will see the following:

phalcon => enabled
phalcon.db.escape_identifiers => On => On
phalcon.db.force_casting => Off => Off
phalcon.orm.cast_on_hydrate => Off => Off
phalcon.orm.column_renaming => On => On
phalcon.orm.disable_assign_setters => Off => Off
phalcon.orm.enable_implicit_joins => On => On
phalcon.orm.enable_literals => On => On => On => On
phalcon.orm.exception_on_failed_save => Off => Off
phalcon.orm.ignore_unknown_columns => Off => Off
phalcon.orm.late_state_binding => Off => Off
phalcon.orm.not_null_validations => On => On
phalcon.orm.update_snapshot_on_save => On => On
phalcon.orm.virtual_foreign_keys => On => On

Last updated: August 31, 2017