首頁 >後端開發 >php教程 >利用PHP扩展vld查看PHP opcode_PHP教程

利用PHP扩展vld查看PHP opcode_PHP教程

WBOY
WBOY原創
2016-07-14 10:09:121171瀏覽

~/public_html/php-5.3.13/ext> wget http://pecl.php.net/get/vld-0.11.2.tgz

~/public_html/php-5.3.13/ext> tar zxvf vld-0.11.2.tgz 
~/public_html/php-5.3.13/ext> cd vld-0.11.2/
接下来编译安装vld扩展:
 
~/public_html/php-5.3.13/ext/vld-0.11.2> phpize 
~/public_html/php-5.3.13/ext/vld-0.11.2> ./configure --with-php-config=/usr/local/services/php/bin/php-config --enable-vld
~/public_html/php-5.3.13/ext/vld-0.11.2> make
~/public_html/php-5.3.13/ext/vld-0.11.2> sudo make install
Installing shared extensions:     /usr/local/services/php/lib/php/extensions/no-debug-non-zts-20090626/
最后将生成的vld.so复制到extension_dir目录下:
 
~/public_html/php-5.3.13/ext/vld-0.11.2> cd /usr/local/services/php/lib/php/extensions/no-debug-non-zts-20090626/
/usr/local/services/php/lib/php/extensions/no-debug-non-zts-20090626> sudo cp vld.so /usr/local/services/php/extensions/
然后修改php.ini文件,添加如下配置:
 
extension=vld.so
接下来创建test.php文件:
 
 
$a = "hello world";
 
echo $a . PHP_EOL;
使用cli来执行,查看生成的opcode:
 
~/public_html> php -dvld.active=1 test.php 
Finding entry points
Branch analysis from position: 0
Return found
filename:       /home/zhanhailiang/public_html/test.php
function name:  (null)
number of ops:  4
compiled vars:  !0 = $a
line     # *  op                           fetch          ext  return  operands
---------------------------------------------------------------------------------
   3     0  >   ASSIGN                                                   !0, 'hello+world'
   5     1      CONCAT                                           ~1      !0, '%0A'
         2      ECHO                                                     ~1
   6     3    > RETURN                                                   1
 
branch: #  0; line:     3-    6; sop:     0; eop:     3
path #1: 0, 
hello world

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/477704.htmlTechArticle~/public_html/php-5.3.13/ext wget http://pecl.php.net/get/vld-0.11.2.tgz ~/public_html/php-5.3.13/ext tar zxvf vld-0.11.2.tgz ~/public_html/php-5.3.13/ext cd vld-0.11.2/ 接下来编译...
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn