In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "the installation method of PHP extension module opcode". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Opdumper
Installation
The source code of Opdumper has been hosted on github at the address of https://github.com/ericzhang-cn/opdumper. You can clone the source code with the following command:
Git clone https://github.com/ericzhang-cn/opdumper.git
Opdumper is a standard PHP Extension, which is installed as follows:
First, put the Opdumper source code in the ext/opdumper directory of the PHP source package, and then enter this directory and execute the following command:
Phpize. / configure make make install
Then add a line of configuration to the php.ini:
Extension=opdumper.so
Currently, opdumper supports PHP > = 5.3.It has passed the test under Linux and MacOS, but has not been tested under Windows.
CLI API
Opdumper supports vld-like command-line output of opcode, simply passing in opdumper.active=1 with the-d argument when executing the php command. For example, we have a foo.php:
Execute the following command:
Php-d opdumper.active=1 foo.php
The results are as follows:
PHP_FUNCTION API
Opdumper also supports PHP_FUNCTION API,Opdumper, which is not supported by vld, and provides two PHP functions: od_dump_opcodes_string and od_dump_opcodes_file. The former accepts a string as a generation, and the string is a piece of PHP code; the latter accepts a PHP file as a parameter, and the return value is an PHP array containing opcode results. Take od_dump_opcodes_file as an example, let's write another bar.php in the same directory as foo.php:
The implementation results are as follows:
Array (3) {[0] = > array (8) {["lineno"] = > int (2) ["opcode"] = > string (11) "ZEND_ASSIGN" ["op1_type"] = > string (2) "CV" ["op2_type"] = > string (5) "CONST" ["result_type"] = > string (0) "[" op1 "] = > string (2)" ~ 0 "[" op2 "] = > string (5)" hello "[" result "] = > string (0)"} [1] = > array (8) {["lineno"] = > int (3) ["opcode"] = > string (9) "ZEND _ ECHO "[" op1_type "] = > string (2)" CV "[" op2_type "] = > string (6)" UNUSED "[" result_type "] = > string (6)" UNUSED "[" op1 "] = > string (2)" ~ 0 "[" op2 "] = > string (6)" UNUSED "[" result "] = > String (6) "UNUSED"} [2] = > array (8) {["lineno"] = > int (5) ["opcode"] = > string (11) "ZEND_RETURN" ["op1_type"] = > string (5) "CONST" ["op2_type"] = > string (6) "UNUSED" ["result_type" ] = > string (6) "UNUSED" ["op1"] = > string (1) "1" ["op2"] = > string (6) "UNUSED" ["result"] = > string (6) "UNUSED"}}
Opdumper's Web service: Opcode Dumper
Frankly speaking, it is troublesome to install the PHP module. So in order to make it easier for my friends to view opcode, I built an online Web service for Opdumper: http://supercompiler.com/app/opcode_dumper.
Web page access
Just visit this page, enter or paste the PHP code in the edit box, and you can quickly see the corresponding opcode:
At the same time, you can download the results locally (in CSV file format).
HTTP API access
You can obtain the opcode of the PHP code by visiting the following API:
URI: http://supercompiler.com/api/dump_opcodes
Method: POST
Params: php_script= [your PHP code]
The return value is in JSON format, the success field is "true" when successful, the success field is "false" when the opcodes; fails, and the msg field stores the reason for the failure.
Because of the spanning relationship, you can only use Curl instead of Ajax to call this API, and the JSONP interface will be added later.
This is the end of the content of "installation method of PHP extension module opcode". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.