系统相关
首页 > 系统相关> > Linux配置yaf3.x.x环境

Linux配置yaf3.x.x环境

作者:互联网

yaf3.x.x需要php7以上的环境。

第一步:配置php7

./install.sh mphp

这里面,我们选择PHP7.2

此时我们看,就会多一个php的文件夹

# whereis php
php: /usr/bin/php /usr/local/php /usr/local/php7.2

第二步配置php7.2中的yaf模块

没装之前

# /usr/local/php7.2/bin/php -m
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvsem
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
zlib

[Zend Modules]

我们可以看到,里面没有yaf模块,也没有redis模块。

下面我们开始安装yaf模块。

sudo wget https://github.com/laruence/yaf/archive/yaf-3.0.9.tar.gz
sudo tar -zvxf yaf-3.0.9.tar.gz
cd yaf-yaf-3.0.9 && /usr/local/php7.2/bin/phpize
./configure --with-php-config=/usr/local/php7.2/bin/php-config
make && make install
make test
vim /usr/local/php7.2/etc/php.ini
extension = "yaf.so"
# lnmp restart
+-------------------------------------------+
|    Manager for LNMP, Written by Licess    |
+-------------------------------------------+
|              https://lnmp.org             |
+-------------------------------------------+
Stoping LNMP...
Stoping nginx...  done
Shutting down MySQL.. SUCCESS! 
Gracefully shutting down php-fpm . done
Gracefully shutting down php-fpm . done
Starting LNMP...
Starting nginx...  done
Starting MySQL. SUCCESS! 
Starting php-fpm  done
Starting php-fpm  done

此时查看模块

#/usr/local/php7.2/bin/php -m
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvsem
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
yaf
zlib

[Zend Modules]

我们发现,多了一个yaf

第三步配置php7.2中的redis模块

redis是必须的,很多项目都需要用到

./addons.sh install redis

就这么简单!

#  /usr/local/php7.2/bin/php -m
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
redis
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvsem
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
yaf
zlib

[Zend Modules]

尝试运行项目

配置nginx

server
    {
        listen 80;
        #listen [::]:80;
        server_name xxx.com;
        index index.html index.htm index.php;
        root  /home/wwwroot/default/official/tiger/public;

        #error_page   404   /404.html;


        include enable-php7.2.conf;

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-known {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }

    location / {
            if (!-e $request_filename) {
                rewrite ^(.*)$ /admin.php?s=$1 last;
                break;
            }
    }

        access_log  /home/wwwlogs/access.official.log;
}

重启lnmp

没毛病。环境搭建ok!

标签:bin,php,配置,php7.2,usr,Linux,yaf,local,yaf3
来源: https://www.cnblogs.com/jiqing9006/p/12120158.html