利用PHP擴張vld查看PHP opcode

來源:互聯網
上載者:User
利用PHP擴充vld查看PHP opcode
  作者:zhanhailiang 日期:2013-03-04

首先下載最新版vld擴充:

~/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 installInstalling 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 pointsBranch analysis from position: 0Return foundfilename:       /home/zhanhailiang/public_html/test.phpfunction name:  (null)number of ops:  4compiled vars:  !0 = $aline     # *  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:     3path #1: 0, hello world

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.