Installing PhalconPHP in Ubuntu 13.10 / 14.04



Here's how I install PhalconPHP

On Linux you can easily compile and install the extension from source code.

Requirements

We need some packages previously installed:

LAMP
PHP 5.x development resources
GCC compiler

                     sudo apt-get install php5-dev php5-mysql gcc

Compilation

1. To create the extension from C source follow these steps:
If you dont have git installed you can install it with this command

sudo apt-get install git
                   git clone --depth=1 git://github.com/phalcon/cphalcon.git
                   cd cphalcon/build
                   sudo ./install


It gives me error:

          In file included from /usr/include/php5/ext/spl/spl_iterators.h:27:0,
                                   from /home/sherwinrobles/Applications/cphalcon/build/32bits/phalcon.c:204:
          /usr/include/php5/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h: No such file or directory
          #include "pcre.h"

The solution :

        The latest version of Phalcon uses PCRE libraries.
        You can install them like so and then try and install Phalcon again:

sudo apt-get install libpcre3-dev


2. Add the extension to your 2 php.ini:

         Find loaded php.ini with these commands

                sudo php -i | grep 'Configuration File'

                Configuration File (php.ini) Path => /etc/php5/cli
                Loaded Configuration File => /etc/php5/cli/php.ini

/etc/php5/cli/php.ini is for the CLI PHP program, which you found by running php on the terminal.
/etc/php5/apache2/php.ini is for the PHP plugin used by Apache.

To open your php.ini:

               sudo gedit /etc/php5/cli/php.ini
               sudo gedit /etc/php5/apache2/php.ini
     
In PhalconPHP 1.3.1 Instead in php.ini it looks for phalcon extension here /etc/php5/cli/conf.d/ & /etc/php5/apache2/conf.d/

You need to load PDO first before Phalcon.
The ini file that loads phalcon should be prefixed to a number higher than the one PDO is. So here you should add phalcon extension:
          sudo gedit /etc/php5/cli/conf.d/50-phalcon.ini 
         sudo gedit /etc/php5/apache2/conf.d/50-phalcon.ini 


paste this:

               extension=phalcon.so  




3. Finally, restart the webserver

               sudo service apache2 restart

Comments