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 extensionBecause 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 installNext you need to manually modify the
php.inifile to load the
yaf.sofile
php.inifile will be automatically configured. There is no need to manually load
yaf.so
$ > pecl install yafAfter the installation is completed Use the command to check whether the installation is successful
$ > php --ri yafIf 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 => OffProject 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_FirstYaf_First is the project name, readers can define it themselves
- Copy the generated code to the generation environment directory
$ > cp -r ./output/Yaf_First/* /home/wwwroot/default/
Welcome to my e-book "When Yaf Meets PHP7.1"