How to install Phalcon on Centos


Here is the example on CentOS 5, 32 Bit.

Requirements for Phalcon 2.0.x

  • PHP >=5.3.21
  • GCC compiler

Step 1: Install GCC

[root@tutorialspots ~]# yum install php-devel php-mysql gcc libtool
Loaded plugins: fastestmirror, protectbase
Determining fastest mirrors
 * epel: linux.mirrors.es.net
 * updates: mirror.pac-12.org
 * base: mirror.keystealth.org
 * addons: mirror.chpc.utah.edu
 * extras: mirrors.easynews.com
epel                                                     | 3.6 kB     00:00
ebe3dc54024daaa756f860e6641e7518b998c163-primary.sqlite. | 2.5 MB     00:00
lxcenter-updates                                         | 2.5 kB     00:00
74bdf27a39b03c9e4af0aa5630b9b5a6f0613f44-primary.sqlite. | 148 kB     00:00
kbs-CentOS-Extras                                        | 1.9 kB     00:00
lxcenter-extra                                           |  951 B     00:00
updates                                                  | 1.9 kB     00:00
primary.sqlite.bz2                                       | 529 kB     00:00
base                                                     | 1.1 kB     00:00
addons                                                   | 1.9 kB     00:00
kbs-CentOS-Testing                                       | 1.9 kB     00:00
extras                                                   | 2.1 kB     00:00
0 packages excluded due to repository protections
Setting up Install Process
Parsing package install arguments
Package libtool-1.5.22-7.el5_4.i386 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package php-mysql.i386 0:5.2.17-37 set to be updated
--> Processing Dependency: php-common = 5.2.17-37 for package: php-mysql
---> Package php-devel.i386 0:5.2.17-37 set to be updated
--> Processing Dependency: php = 5.2.17-37 for package: php-devel
--> Processing Dependency: gcc = 4.1.2-52.el5_8.1 for package: gcc-c++
---> Package gcc.i386 0:4.1.2-55.el5 set to be updated
--> Processing Dependency: cpp = 4.1.2-55.el5 for package: gcc
--> Processing Dependency: libgcc >= 4.1.2-55.el5 for package: gcc
--> Running transaction check
---> Package gcc-c++.i386 0:4.1.2-55.el5 set to be updated
--> Processing Dependency: libstdc++ = 4.1.2-55.el5 for package: gcc-c++
--> Processing Dependency: libstdc++-devel = 4.1.2-55.el5 for package: gcc-c++
---> Package php-common.i386 0:5.2.17-37 set to be updated
---> Package cpp.i386 0:4.1.2-55.el5 set to be updated
---> Package php.i386 0:5.2.17-37 set to be updated
--> Processing Dependency: php-cli = 5.2.17-37 for package: php
--> Processing Dependency: php-common = 5.2.17-24 for package: php-mbstring
--> Processing Dependency: php-common = 5.2.17-24 for package: php-soap
--> Processing Dependency: php-common = 5.2.17-24 for package: php-gd
--> Processing Dependency: php-common = 5.2.17-24 for package: php-pdo
--> Processing Dependency: php-common = 5.2.17-24 for package: php-xml
--> Processing Dependency: php-common = 5.2.17-24 for package: php-mcrypt
--> Processing Dependency: php-common = 5.2.17-24 for package: php-imap
---> Package libgcc.i386 0:4.1.2-55.el5 set to be updated
--> Running transaction check
---> Package php-gd.i386 0:5.2.17-37 set to be updated
---> Package php-xml.i386 0:5.2.17-37 set to be updated
---> Package php-mbstring.i386 0:5.2.17-37 set to be updated
---> Package php-imap.i386 0:5.2.17-37 set to be updated
---> Package php-mcrypt.i386 0:5.2.17-37 set to be updated
---> Package php-cli.i386 0:5.2.17-37 set to be updated
---> Package libstdc++.i386 0:4.1.2-55.el5 set to be updated
---> Package php-soap.i386 0:5.2.17-37 set to be updated
---> Package php-pdo.i386 0:5.2.17-37 set to be updated
---> Package libstdc++-devel.i386 0:4.1.2-55.el5 set to be updated
e95688a143acb873e7ff6c0d27809c4eebc3ffef-filelists.sqlit | 3.6 MB     00:00
804629ebff302a782dfce06f63e3117012e5741f-filelists.sqlit |  98 kB     00:00
filelists.sqlite.bz2                                     |  564 B     00:00
filelists.xml.gz                                         | 3.1 MB     00:00
filelists.sqlite.bz2                                     | 2.7 MB     00:00
filelists.sqlite.bz2                                     | 1.0 MB     00:01
filelists.sqlite.bz2                                     | 212 kB     00:00
--> Processing Dependency: /usr/lib/libstdc++.so.6 for package: libstdc++-devel
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package postgresql-devel.i386 0:8.1.23-10.el5_10 set to be updated
--> Processing Dependency: postgresql-libs = 8.1.23-10.el5_10 for package: postg
resql-devel
--> Processing Dependency: postgresql = 8.1.23-10.el5_10 for package: postgresql
-devel
--> Running transaction check
---> Package postgresql-libs.i386 0:8.1.23-10.el5_10 set to be updated
---> Package postgresql.i386 0:8.1.23-10.el5_10 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package              Arch     Version               Repository            Size
================================================================================
Updating:
 cpp                  i386     4.1.2-55.el5          base                 2.7 M
 gcc                  i386     4.1.2-55.el5          base                 5.2 M
 gcc-c++              i386     4.1.2-55.el5          base                 3.4 M
 libgcc               i386     4.1.2-55.el5          base                  97 k
 libstdc++            i386     4.1.2-55.el5          base                 364 k
 libstdc++-devel      i386     4.1.2-55.el5          base                 2.8 M
 php                  i386     5.2.17-37             lxcenter-updates     1.2 M
 php-cli              i386     5.2.17-37             lxcenter-updates     2.3 M
 php-common           i386     5.2.17-37             lxcenter-updates     278 k
 php-devel            i386     5.2.17-37             lxcenter-updates     555 k
 php-gd               i386     5.2.17-37             lxcenter-updates     124 k
 php-imap             i386     5.2.17-37             lxcenter-updates      53 k
 php-mbstring         i386     5.2.17-37             lxcenter-updates     1.1 M
 php-mcrypt           i386     5.2.17-37             lxcenter-updates      30 k
 php-mysql            i386     5.2.17-37             lxcenter-updates      84 k
 php-pdo              i386     5.2.17-37             lxcenter-updates      66 k
 php-soap             i386     5.2.17-37             lxcenter-updates     146 k
 php-xml              i386     5.2.17-37             lxcenter-updates     115 k
 postgresql-libs      i386     8.1.23-10.el5_10      base                 198 k
Installing for dependencies:
 postgresql           i386     8.1.23-10.el5_10      base                 2.9 M
 postgresql-devel     i386     8.1.23-10.el5_10      base                 1.2 M

Transaction Summary
================================================================================
Install      2 Package(s)
Update      19 Package(s)
Remove       0 Package(s)

Total download size: 25 M
Is this ok [y/N]: y
Downloading Packages:
(1/21): php-mcrypt-5.2.17-37.i386.rpm                    |  30 kB     00:00
(2/21): php-imap-5.2.17-37.i386.rpm                      |  53 kB     00:00
(3/21): php-pdo-5.2.17-37.i386.rpm                       |  66 kB     00:00
(4/21): php-mysql-5.2.17-37.i386.rpm                     |  84 kB     00:00
(5/21): libgcc-4.1.2-55.el5.i386.rpm                     |  97 kB     00:00
(6/21): php-xml-5.2.17-37.i386.rpm                       | 115 kB     00:00
(7/21): php-gd-5.2.17-37.i386.rpm                        | 124 kB     00:00
(8/21): php-soap-5.2.17-37.i386.rpm                      | 146 kB     00:00
(9/21): postgresql-libs-8.1.23-10.el5_10.i386.rpm        | 198 kB     00:00
(10/21): php-common-5.2.17-37.i386.rpm                   | 278 kB     00:00
(11/21): libstdc++-4.1.2-55.el5.i386.rpm                 | 364 kB     00:00
(12/21): php-devel-5.2.17-37.i386.rpm                    | 555 kB     00:00
(13/21): php-mbstring-5.2.17-37.i386.rpm                 | 1.1 MB     00:00
(14/21): postgresql-devel-8.1.23-10.el5_10.i386.rpm      | 1.2 MB     00:00
(15/21): php-5.2.17-37.i386.rpm                          | 1.2 MB     00:00
(16/21): php-cli-5.2.17-37.i386.rpm                      | 2.3 MB     00:00
(17/21): cpp-4.1.2-55.el5.i386.rpm                       | 2.7 MB     00:00
(18/21): libstdc++-devel-4.1.2-55.el5.i386.rpm           | 2.8 MB     00:00
(19/21): postgresql-8.1.23-10.el5_10.i386.rpm            | 2.9 MB     00:00
(20/21): gcc-c++-4.1.2-55.el5.i386.rpm                   | 3.4 MB     00:00
(21/21): gcc-4.1.2-55.el5.i386.rpm                       | 5.2 MB     00:00
--------------------------------------------------------------------------------
Total                                           8.7 MB/s |  25 MB     00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : php-common                                      [ 1/40]
  Updating       : libgcc                                          [ 2/40]
  Updating       : libstdc++                                       [ 3/40]
  Updating       : postgresql-libs                                 [ 4/40]
  Updating       : php-pdo                                         [ 5/40]
  Installing     : postgresql                                      [ 6/40]
  Updating       : php-cli                                         [ 7/40]
  Updating       : php                                             [ 8/40]
  Updating       : cpp                                             [ 9/40]
  Updating       : gcc                                             [10/40]
  Installing     : postgresql-devel                                [11/40]
  Updating       : php-mysql                                       [12/40]
  Updating       : php-xml                                         [13/40]
  Updating       : php-gd                                          [14/40]
  Updating       : php-soap                                        [15/40]
  Updating       : php-mbstring                                    [16/40]
  Updating       : php-imap                                        [17/40]
  Updating       : php-mcrypt                                      [18/40]
  Updating       : libstdc++-devel                                 [19/40]
  Updating       : gcc-c++                                         [20/40]
  Updating       : php-devel                                       [21/40]
  Cleanup        : php-xml                                         [22/40]
  Cleanup        : php-gd                                          [23/40]
  Cleanup        : libstdc++-devel                                 [24/40]
  Cleanup        : postgresql-libs                                 [25/40]
  Cleanup        : php-soap                                        [26/40]
  Cleanup        : gcc-c++                                         [27/40]
  Cleanup        : cpp                                             [28/40]
  Cleanup        : php-mysql                                       [29/40]
  Cleanup        : php-mbstring                                    [30/40]
  Cleanup        : libstdc++                                       [31/40]
  Cleanup        : php-imap                                        [32/40]
  Cleanup        : php                                             [33/40]
  Cleanup        : php-mcrypt                                      [34/40]
  Cleanup        : php-cli                                         [35/40]
  Cleanup        : php-pdo                                         [36/40]
  Cleanup        : gcc                                             [37/40]
  Cleanup        : libgcc                                          [38/40]
  Cleanup        : php-common                                      [39/40]
  Cleanup        : php-devel                                       [40/40]

Dependency Installed: postgresql.i386 0:8.1.23-10.el5_10 postgresql-devel.i386 0
:8.1.23-10.el5_10
Updated: cpp.i386 0:4.1.2-55.el5 gcc.i386 0:4.1.2-55.el5 gcc-c++.i386 0:4.1.2-55
.el5 libgcc.i386 0:4.1.2-55.el5 libstdc++.i386 0:4.1.2-55.el5 libstdc++-devel.i3
86 0:4.1.2-55.el5 php.i386 0:5.2.17-37 php-cli.i386 0:5.2.17-37 php-common.i386
0:5.2.17-37 php-devel.i386 0:5.2.17-37 php-gd.i386 0:5.2.17-37 php-imap.i386 0:5
.2.17-37 php-mbstring.i386 0:5.2.17-37 php-mcrypt.i386 0:5.2.17-37 php-mysql.i38
6 0:5.2.17-37 php-pdo.i386 0:5.2.17-37 php-soap.i386 0:5.2.17-37 php-xml.i386 0:
5.2.17-37 postgresql-libs.i386 0:8.1.23-10.el5_10
Complete!

install phalcon step 1

Step 2: install GIT

[root@tutorialspots ~]# yum install git
Loaded plugins: fastestmirror, protectbase
Loading mirror speeds from cached hostfile
 * epel: linux.mirrors.es.net
 * updates: mirror.pac-12.org
 * base: mirror.keystealth.org
 * addons: mirror.chpc.utah.edu
 * extras: mirrors.easynews.com
0 packages excluded due to repository protections
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package git.i386 0:1.8.2.1-1.el5 set to be updated
--> Processing Dependency: perl-Git = 1.8.2.1-1.el5 for package: git
--> Processing Dependency: perl(Term::ReadKey) for package: git
--> Processing Dependency: perl(Git) for package: git
--> Processing Dependency: perl(Error) for package: git
--> Running transaction check
---> Package perl-Git.i386 0:1.8.2.1-1.el5 set to be updated
---> Package perl-Error.noarch 1:0.17010-1.el5 set to be updated
---> Package perl-TermReadKey.i386 0:2.30-4.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                 Arch          Version                Repository   Size
================================================================================
Installing:
 git                     i386          1.8.2.1-1.el5          epel        7.3 M
Installing for dependencies:
 perl-Error              noarch        1:0.17010-1.el5        epel         26 k
 perl-Git                i386          1.8.2.1-1.el5          epel         49 k
 perl-TermReadKey        i386          2.30-4.el5             epel         32 k

Transaction Summary
================================================================================
Install      4 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 7.4 M
Is this ok [y/N]:y
Downloading Packages:
(1/4): perl-Error-0.17010-1.el5.noarch.rpm               |  26 kB     00:00
(2/4): perl-TermReadKey-2.30-4.el5.i386.rpm              |  32 kB     00:00
(3/4): perl-Git-1.8.2.1-1.el5.i386.rpm                   |  49 kB     00:00
(4/4): git-1.8.2.1-1.el5.i386.rpm                        | 7.3 MB     00:01
--------------------------------------------------------------------------------
Total                                           4.7 MB/s | 7.4 MB     00:01
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 217521f6
Importing GPG key 0x217521F6 "Fedora EPEL <epel@fedoraproject.org>" from /etc/pk
i/rpm-gpg/RPM-GPG-KEY-EPEL
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : perl-Error                                        [1/4]
  Installing     : perl-TermReadKey                                  [2/4]
  Installing     : git                                               [3/4]
  Installing     : perl-Git                                          [4/4]

Installed: git.i386 0:1.8.2.1-1.el5
Dependency Installed: perl-Error.noarch 1:0.17010-1.el5 perl-Git.i386 0:1.8.2.1-
1.el5 perl-TermReadKey.i386 0:2.30-4.el5
Complete!

Step 3: Download source

[root@tutorialspots ~]# git clone --depth=1 git://github.com/phalcon/cphalcon.git
Cloning into 'cphalcon'...
remote: Counting objects: 2252, done.
remote: Compressing objects: 100% (1761/1761), done.
remote: Total 2252 (delta 777), reused 1022 (delta 319), pack-reused 0
Receiving objects: 100% (2252/2252), 4.02 MiB | 3.81 MiB/s, done.
Resolving deltas: 100% (777/777), done.

Step 4: Install Phalcon

install phalcon step 4

[root@tutorialspots build]# ./install
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la   modules/* libs/*
Cleaning..
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for icc... no
checking for suncc... no
checking whether gcc and cc understand -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i686-redhat-linux-gnu
checking host system type... i686-redhat-linux-gnu
checking target system type... i686-redhat-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/i
nclude/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/ph
p/ext/date/lib
checking for PHP extension directory... /usr/lib/php/modules
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate
 PHP parsers.
checking for gawk... gawk
checking whether to enable phalcon... yes, shared
checking whether HAVE_BUNDLED_PCRE is declared... yes
checking for ext/pcre/php_pcre.h... yes
checking whether HAVE_JSON is declared... yes
checking for ext/json/php_json.h... yes
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for epcf90... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for gfortran... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating libtool
appending configuration tag "CXX" to libtool
appending configuration tag "F77" to libtool
configure: creating ./config.status
config.status: creating config.h
/bin/sh /root/cphalcon/build/32bits/libtool --mode=compile gcc  -I. -I/root/cpha
lcon/build/32bits -DPHP_ATOM_INC -I/root/cphalcon/build/32bits/include -I/root/c
phalcon/build/32bits/main -I/root/cphalcon/build/32bits -I/usr/include/php -I/us
r/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/includ
e/php/ext -I/usr/include/php/ext/date/lib  -DPHALCON_RELEASE -DHAVE_CONFIG_H  -O
2 -fomit-frame-pointer -fvisibility=hidden   -c /root/cphalcon/build/32bits/phal
con.zep.c -o phalcon.lo
mkdir .libs
 gcc -I. -I/root/cphalcon/build/32bits -DPHP_ATOM_INC -I/root/cphalcon/build/32b
its/include -I/root/cphalcon/build/32bits/main -I/root/cphalcon/build/32bits -I/
usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/p
hp/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DPHALCON_RELEASE
 -DHAVE_CONFIG_H -O2 -fomit-frame-pointer -fvisibility=hidden -c /root/cphalcon/
build/32bits/phalcon.zep.c  -fPIC -DPIC -o .libs/phalcon.o
In file included from /root/cphalcon/build/32bits/phalcon.zep.c:175:
/root/cphalcon/build/32bits/phalcon.zep.h:18779:7: warning: no newline at end of
 file
/bin/sh /root/cphalcon/build/32bits/libtool --mode=link gcc -DPHP_ATOM_INC -I/ro
ot/cphalcon/build/32bits/include -I/root/cphalcon/build/32bits/main -I/root/cpha
lcon/build/32bits -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/
TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/
lib  -DPHALCON_RELEASE -DHAVE_CONFIG_H  -O2 -fomit-frame-pointer -fvisibility=hi
dden   -o phalcon.la -export-dynamic -avoid-version -prefer-pic -module -rpath /
root/cphalcon/build/32bits/modules  phalcon.lo
gcc -shared  .libs/phalcon.o   -Wl,-soname -Wl,phalcon.so -o .libs/phalcon.so
creating phalcon.la
(cd .libs && rm -f phalcon.la && ln -s ../phalcon.la phalcon.la)
/bin/sh /root/cphalcon/build/32bits/libtool --mode=install cp ./phalcon.la /root
/cphalcon/build/32bits/modules
cp ./.libs/phalcon.so /root/cphalcon/build/32bits/modules/phalcon.so
cp ./.libs/phalcon.lai /root/cphalcon/build/32bits/modules/phalcon.la
PATH="$PATH:/sbin" ldconfig -n /root/cphalcon/build/32bits/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /root/cphalcon/build/32bits/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/lib/php/modules/
Installing header files:          /usr/include/php/

Thanks for compiling Phalcon!
Build succeed: Please restart your web server to complete the installation

Now, add to your php.ini

extension=phalcon.so

Example for Kloxo, create file phalcon.ini with the content above and upload file to /etc/php.d/

phalcon php ini

Done! restart your server.

You can test with phpinfo

phalcon phpinfo

Leave a Reply