Last Updated:

Install and configure PHP Framework Phalcon from Apache on Linux - Ubuntu, Mint, Debian.


Phalcon PHP. Installation and configuration.


PHP Framework Phalcon - PHP - a framework supplied as C - extension.
Phalcon is built on an innovative architecture, which makes it the fastest PHP framework in existence!

Installing Phalcon is different from installing other traditional frameworks. To install Phalcon, you need to download the extension package or compile it from source. This article provides an example of how to compile Phalcon from source and use on such operating systems as Linux - Ubuntu, Mint, Debian, etc.

Install Phalcon PHP Extension.

To use Phalcon you need Apache2 + mysql + php5. Let's assume that you have them installed. If not, then read Linux - install apache2, php, mysql, phpmyadmin.

To install, you will need the following dependencies:

Create a directory where Phalcon will be located. Go to it in the console (terminal).
Get Sources:

When the sources are downloaded you will have the following folder: cphalcon.

It is necessary to give the rights 777 to the cphalcon

folder Let's go to it, namely to the folder build:

Start compiling:

It will take some time to compile.

sudo apt-get install git-core gcc autoconf
sudo apt-get install php5-dev php5-mysql
sudo git clone git:// 
sudo chmod -R 777 cphalcon
cd cphalcon/build
sudo ./install

If you encounter an error during the installation of phalcon:

You need to install libpcre3-dev.

And repeat:

fatal error: pcre.h: No such file or directory
compilation terminated.
make: *** [phalcon.lo] Error 1
sudo apt-get install libpcre3-dev

sudo ./install

Now you will need to register Phalcon as a PHP extension.
Let's create a configuration file for this:

In it we will write the following configurations for Phalcon:

To activate Phalcon, you need to create 2 symbolic links to this configuration file:

Now you need to restart the Apache web server on your Linux:

Congratulations! Your extension is now registered!

You can check as follows:

You should see a message similar to the following:
sudo nano /etc/php5/mods-available/phalcon.ini

; configuration for PHP Framework Phalcon
sudo ln -s /etc/php5/mods-available/phalcon.ini /etc/php5/apache2/conf.d/20-phalcon.ini
sudo ln -s /etc/php5/mods-available/phalcon.ini /etc/php5/cli/conf.d/20-phalcon.ini
sudo /etc/init.d/apache2 restart
php -r "print_r(get_loaded_extensions());" | grep phalcon


[49] => phalcon

Install Phalcon DevTools.

This toolbar will allow you to manage your Phalcon project in the console.
Create the directory where you want to install the Phalcon toolbar(DevTools).
Get sources:

A folder named phalcon-devtools should appear.
Let's give 777 permissions to the phalcon-devtools folder.

Let's go to the phalcon-devtools:

Write ls folder.
It should contain the installer
Start the installer:
sudo git clone
sudo chmod -R 777 phalcon-devtools
cd phalcon-devtools

sudo ./ 

Phalcon DevTools teams.

After installing Phalcon DevTools, you will have access to a list of tools under the command:

Write in the console:

After which you will be presented with a list of available commands:

Available commands:
commands (alias of: list, enumerate)
controller (alias of: create-controller)
model (alias of: create-model)
all-models (alias of: create-all-models)
project (alias of: create-project)
scaffold (alias of: create-scaffold)
migration (alias of: create-migration)
webtools (alias of: create-webtools)


The phalcon command will be available on the system after the session reboot. Reboot your PC.
After rebooting, the interpreter will know where the executable is located.

Phalcon-devtools does not work!

If after installing phalcon devtools for some reason does not work or you have an error:
chmod: unable to process hung character link "/usr/bin/phalcon"

The solution to the problem is as follows:
Set the permissions to 751 on the bin:

Folder and you also need to set the rights to the folder from your phalcon devtools.
sudo chmod 751 /usr/bin/

sudo chmod -R 777 /path to phalcon devtools/phalcon-devtools

sudo chmod -R 777 /var/phalcon-devtools

Let's create a symbolic link to the phalcon file.php:
sudo ln -s /path to phalcon devtools/ directory with phalcon devtools/phalcon.php /usr/bin/phalcon


Grant the necessary permissions:

Reboot the system and the phalcon command becomes available.
sudo ln -s /var/phalcon-devtools/phalcon.php /usr/bin/phalcon
sudo chmod ugo+x /usr/bin/phalcon