php扩展库 地址:https://pecl.php.net
yar扩展地址 https://pecl.php.net/package/yar
我选择下载到/root yar-2.1.2 版本
[root@VM-0-11-centos ~]#wget -P /root https://pecl.php.net/get/yar-2.1.2.tgz
[root@VM-0-11-centos ~]#cd /root
[root@VM-0-11-centos yar-2.1.2]#tar -xzvf yar-2.1.2.tgz
[root@VM-0-11-centos yar-2.1.2]#cd yar-2.1.2
[root@VM-0-11-centos yar-2.1.2]# find / -name phpize
/usr/local/php/bin/phpize
/usr/bin/phpize
[root@VM-0-11-centos yar-2.1.2]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20180731
Zend Module Api No: 20180731
Zend Extension Api No: 320180731
[root@VM-0-11-centos yar-2.1.2]# find / -name php-config
/usr/local/php/bin/php-config
[root@VM-0-11-centos yar-2.1.2]#./configure --with-php-config=/usr/local/php/bin/php-config
[root@VM-0-11-centos yar-2.1.2]#make
[root@VM-0-11-centos yar-2.1.2]#make install
.....
----------------------------------------------------------------------
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/
[root@VM-0-11-centos yar-2.1.2]# cd /usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/
[root@VM-0-11-centos no-debug-non-zts-20180731]# ll
total 27232
-rwxr-xr-x 1 root root 4238044 Nov 14 12:50 opcache.a
-rwxr-xr-x 1 root root 2293312 Nov 14 12:50 opcache.so
-rwxr-xr-x 1 root root 20723344 Nov 14 14:06 swoole.so
-rwxr-xr-x 1 root root 215432 Nov 18 13:34 yac.so
-rwxr-xr-x 1 root root 407280 Nov 18 11:24 yar.so
可以看到已经有yar.so了
[root@VM-0-11-centos no-debug-non-zts-20180731]# find / -name php.ini
/usr/local/php/etc/php.ini
编辑php.ini
vi /usr/local/php/etc/php.ini
extension=yar.so 拓展添加
php -m 或 phpinfo没有看到yar 重启nginx,php-fpm
[root@VM-0-11-centos no-debug-non-zts-20180731]# service nginx restart
Stoping nginx... done
Starting nginx... done
[root@VM-0-11-centos no-debug-non-zts-20180731]# service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm done