Build process completed successfully
Installing '/usr/lib/php/20160303/vld.so'
install ok: channel://pecl.php.net/vld-0.14.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=vld.so" to php.ini
添加将扩展加入到php.ini中
$ cd /etc/php/7.1/mods-available
$ touch vld.ini #将划线以下的部分添加到文件中
-------------------
; configuration for php VLD module
; ; priority=20
extension=/usr/lib/php/20160303/vld.so
做软链接
$ cd /etc/php/7.1/cli/conf.d/
$ sudo ln -s ../../mods-available/vld.ini 20-vld.ini
$ cd /etc/php/7.1/apache2/conf.d/
$ sudo ln -s ../../mods-available/vld.ini 20-vld.ini
重启查看phpinfo信息即可
使用
新建两个php文件,输出一个用 . ,一个用 , 连起来
1.php
<?php echo"Hello"." "."world!"?>
2.php
<?php echo"Hello"," ","world!"?>
分别开启两个终端,在cli命令行下执行
$ php -dvld.active=1 1.php
结果:
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename: /home/revin/work/code/test/1.php
function name: (null)
number of ops: 5
compiled vars: none
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
1 0 E > EXT_STMT
1 ECHO 'Hello+world%21'
2 EXT_STMT
3 ECHO '++'
4 > RETURN 1
branch: # 0; line: 1- 1; sop: 0; eop: 4; out1: -2
path #1: 0,
Hello world!
$ php -dvld.active=1 2.php
结果:
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename: /home/revin/work/code/test/2.php
function name: (null)
number of ops: 9
compiled vars: none
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
1 0 E > EXT_STMT
1 ECHO 'Hello'
2 EXT_STMT
3 ECHO '+'
4 EXT_STMT
5 ECHO 'world%21'
6 EXT_STMT
7 ECHO '++'
8 > RETURN 1
branch: # 0; line: 1- 1; sop: 0; eop: 8; out1: -2
path #1: 0,
Hello world!