Home >Backend Development >PHP7 >How to install Phalcon framework for PHP7?

How to install Phalcon framework for PHP7?

coldplay.xixi
coldplay.xixiforward
2020-06-19 17:19:303615browse

How to install Phalcon framework for PHP7?

What is Phalcon?

Phalcon is an open source, full-featured stack, PHP 5 framework written using C extensions and optimized for high performance. Developers do not need to learn and use the functions of C language, because all functions are exposed in the form of PHP classes and can be used directly. Phalcon is also loosely coupled, so you can use other objects as needed for your project.

The current stable version of Phalcon is 2.0. It supports PHP versions from 5.3 to 5.6 and does not support PHP7. 2.1.x is a beta version that supports PHP7. Therefore, if you want to use Phalcon for production environment, please use 5.6.

Installing Zephir

Phalcon2.1.x, which supports PHP7 version, does not support normal compilation and installation and can only be installed through zephir. Therefore, before installing phalcon, please install Zephire first. The installation method is as follows:

$zypper in re2c #Opensuse 安装zephir解释器
$git clone https://github.com/phalcon/zephir.git
$cd zephir
$./install -c #-c表示全局安装,需要root密码

Other versions of Linux can search and install re2c by themselves, and Mac can also install it through brew.
After the installation is completed, you can view the relevant command parameters and functions through the zephir command

Compile and install phalcon

Please confirm before compilingwhich php And which phpize points to the PHP7 version
The installation code is as follows:

git clone http://github.com/phalcon/cphalcon
cd cphalcon
git checkout 2.1.x
zephir build --backend=ZendEngine3

After compilation is completed, extension=phalcon.so will be added to php.iniFile, restart php-fpm and nginx (I installed lnmp).
You can check whether the installation is successful through php -i|grep phalcon, or you can check through the web page output phpinfo()

Reference materials

zephir
#11635
Phalcon 2.1.0 RC1 released

Recommended tutorial: "php tutorial"

The above is the detailed content of How to install Phalcon framework for PHP7?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete

Related articles

See more