← ServerPilot Docs

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.

Phalcon does not yet support 7.3.

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://github.com/phalcon/cphalcon.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 commands as root:

sudo bash -c "echo extension=phalcon.so > /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
phalcon.orm.events => 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

Uninstalling the Phalcon Extension

To uninstall this extension, as root run the command:

sudo rm /etc/phpX.Y-sp/conf.d/phalcon.ini

Next, restart PHP-FPM with the command:

sudo service phpX.Y-fpm-sp restart
Last updated: October 8, 2018

Launch your first site in 5 minutes