DEV Community

Teddy Zugana
Teddy Zugana

Posted on

How install PHP Phalcon Framework on CentOS 6

THE STEPS

  1. Updated all repo centos

    sudo yum update

  2. Then I installed the proper php devel pacakage along with other depencies that were needed for the install by using the command

    yum — enablerepo=remi,remi-php54 install php-devel

  3. Then I had to also install the gcc package from yum with the following

    sudo yum install gcc

  4. Then I downloaded the phalcon repo from github.com and ran the following commands

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

or you can build from ext folder with these command :

cd cphalcon/ext
phpize
./configure
make clean
make && sudo make install

  1. I Restart the webserver :

sudo service httpd restart

  1. I also created a phalcon.ini file to included in the php runtime configuration in the folder /etc/php.d/phalcon.ini. It had the following line:

extension=phalcon.so

To make sure Phalcon installed properly, make a dummy php page and use phpinfo() to see if Phalcon is installed and enabled.

  1. restart httpd again : sudo service httpd restart

Then check if phalcon get error or trouble on php with :

php -m | grep phalcon
Enter fullscreen mode Exit fullscreen mode

If get this php warning:

Cannot load module 'phalcon' because required module 'psr' is not loaded in Unknown on line 0

that mean need compile and install php-psr package first

You have installed v4 phalcon which requires the PSR extension to be loaded first.

Have a look at this article: https://docs.phalconphp.com/4.0/en/upgrade

In short psr.so

PHP-PSR References:

https://github.com/jbboehr/php-psr
Enter fullscreen mode Exit fullscreen mode

Phalcon requires the PSR extension. The extension can be downloaded and compiled from this GitHub repository. Installation instructions are available in the README of the repository. Once the extension has been compiled and is available in your system, you will need to load it to your php.ini. You will need to add this line:

extension=psr.so

before

extension=phalcon.so

Alternatively some distributions add a number prefix on ini files. If that is the case, choose a high number for Phalcon

restarted webserver after changing the php.ini file

sudo service httpd restart

create a temporary info.php page (restrict the script or remove after checking it) with the following content:

<?php
phpinfo();
?>

Check the phpinfo page at your host:

http://yourhost/info.php

You should see the most current version of Phalcon loaded on your phpinfo

make sure Phalcon loaded on your phpinfo

Top comments (0)