Home > Backend Development > PHP7 > body text

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

藏色散人
Release: 2023-02-18 08:12:02
forward
1562 people have browsed it

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
Copy after login
Next you need to manually modify the

php.ini file to load the yaf.so file

2. pecl installation

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

php.ini file will be automatically configured. There is no need to manually load yaf.so

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

$ > php --ri yaf
Copy after login
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
Copy after login
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/
Copy after login
2. Use the scaffolding tool to generate the basic framework code

$ > php yaf_cg Yaf_First
Copy after login
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/
    Copy after login
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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!