Home>Article>Backend Development> What sparks will there be when Yaf encounters PHP7.1?

What sparks will there be when Yaf encounters PHP7.1?

藏色散人
藏色散人 forward
2021-09-14 16:46:19 1519browse

Installing Yaf


##This article assumes that you have installed the LNMP development environment (PHP version is not lower than 7.0) , start the description directly from installing the Yaf extension

Because Yaf is a PHP framework developed in C language, it can also be understood as a PECL extension. Therefore, it is different from the frameworks developed with PHP that we usually encounter, such as ThinkPHP5. Laravel can be downloaded directly or installed and used through Composer. Yaf needs to install the extension before it can be used normally.

First of all, let’s introduce how to install Yaf extension

Installation

The latest version of Yaf supports at least PHP7.0, so we need to ensure that the current PHP environment is version 7.0 or above. The highest version of Yaf that supports PHP5.X is 2.3.4. The author no longer recommends using the old version of Yaf. Since Yaf is famous for its high performance, and PHP7 is also famous for its high performance, why not let the two powerful forces join forces?

1. Compile and install

Compile and install first need to download the source code through Git

First download the Yaf compilation and installation package and open (https://github.com/laruence/y...

$ > wget -c https://github.com/laruence/yaf/archive/yaf-3.0.5.tar.gz $ > tar xzvf yaf-3.0.5.tar.gz && cd yaf-3.0.5 $ > phpize $ > ./configure $ > make $ > sudo make install
Next you need to manually modify the

php.inifile to load theyaf.sofile

2. pecl installation

Install Yaf directly through the pecl command. After successful installation, the

php.inifile will be automatically configured. There is no need to manually loadyaf.so

$ > pecl install yaf
After the installation is completed Use the command to check whether the installation is successful

$ > php --ri yaf
If you get the Yaf version number and configuration details, the installation is successful, as follows

$ > php --ri yaf yaf yaf support => enabled Version => 3.0.5 Supports => http://pecl.php.net/package/yaf Directive => Local Value => Master Value yaf.library => no value => no value yaf.action_prefer => Off => Off yaf.lowcase_path => Off => Off yaf.use_spl_autoload => Off => Off yaf.forward_limit => 5 => 5 yaf.name_suffix => On => On yaf.name_separator => no value => no value yaf.st_compatible => Off => Off yaf.environ => product => product yaf.use_namespace => Off => Off
Project configuration

Use the Yaf scaffolding tool to generate the basic framework

1. Enter the directory where the scaffolding tool is located in the Yaf source code package

$ > cd yaf-3.0.5/tools/cg/
2. Use the scaffolding tool to generate the basic framework code

$ > php yaf_cg Yaf_First
Yaf_First is the project name, readers can define it themselves

  1. Copy the generated code to the generation environment directory

  2. $ > cp -r ./output/Yaf_First/* /home/wwwroot/default/
This completes the construction of the Yaf basic framework code, more details (Yaf interface development, command line development, crawler development)

Welcome to my e-book "When Yaf Meets PHP7.1"

Recommended study: "

PHP7 Tutorial

The above is the detailed content of What sparks will there be when Yaf encounters PHP7.1?. 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