Install PHP's parsekit extension view opcode

Source: Internet
Author: User
Tags constant install php ini php code zend

We know that PHP is an interpreted language, and dynamic content written with them relies on the corresponding interpreter program to run, and the interpreter program needs to parse the input script code and generate the intermediate code that can be run directly, also known as the opcode (Operate code,opcode).

To see the opcode of a PHP program, you need to install the PHP parsekit extension. The
installation process is as follows:
[root@localhost ~]# wget http://pecl.php.net/get/parsekit-1.3.0.tgz
[root@localhost ~]# tar zxvf Parsekit-1.3.0.tgz
[root@localhost ~]# cd parsekit-1.3.0
[root@localhost parsekit-1.3.0]#/usr/local/php/bin/ Phpize
Configuring for:
PHP Api version:         20041225
Zend Module API no:      20060613
Zend Extension API no:   220060519
[ Root@localhost parsekit-1.3.0]#./configure-with-php-config=/usr/local/php/bin/php-config
[root@localhost parsekit-1.3.0]# make
[root@localhost parsekit-1.3.0]# make install
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
Then edit php.ini file, add
extension= inside Parsekit.so
[root@localhost parsekit-1.3.0]# Vim/usr/local/php/etc/php.ini
So we have successfully installed the Parsekit extension ( Note: The landlord is installed under the php5.2 parsekit extension, under the php5.4,php5.5 will be prompted to compile failure).

Of course there is a simpler way to install Parsekit, which is to use pecl directly.
At the command line, enter the command:
[root@localhost parsekit-1.3.0]#/usr/local/php/bin/pecl Install Parsekit
This will automatically help you install the Parsekit.

Then, we enter at the command line:
[Root@localhost parsekit-1.3.0]#/usr/local/php/bin/php-r] Var_dump (parsekit_compile_string (' Print 1+1; '); "
This allows you to view the opcode of the PHP code.
The results are as follows:
Array (20) {
[' Type ']=>
Int (4)
["Type_name"]=>
String "Zend_eval_code"
["Fn_flags"]=>
Int (0)
["Num_args"]=>
Int (0)
["Required_num_args"]=>
Int (0)
["Pass_rest_by_reference"]=>
BOOL (FALSE)
["Uses_this"]=>
BOOL (FALSE)
["Line_start"]=>
Int (0)
["Line_end"]=>
Int (0)
["Return_reference"]=>
BOOL (FALSE)
["RefCount"]=>
Int (1)
["Last"]=>
Int (5)
[' Size ']=>
Int (5)
["T"]=>
Int (2)
["Last_brk_cont"]=>
Int (0)
["Current_brk_cont"]=>
Int (4294967295)
["Backpatch_count"]=>
Int (0)
["Done_pass_two"]=>
BOOL (TRUE)
["FileName"]=>
String (Parsekit Compiler)
["Opcodes"]=>
Array (5) {
[0]=>
Array (8) {
["Address"]=>
Int (29981148)
["OpCode"]=>
Int (1)
["Opcode_name"]=>
String (8) "Zend_add"
["Flags"]=>
Int (197378)
["Result"]=>
Array (3) {
[' Type ']=>
Int (2)
["Type_name"]=>
String (Ten) "Is_tmp_var"
["Var"]=>
Int (0)
}
["OP1"]=>
Array (3) {
[' Type ']=>
Int (1)
["Type_name"]=>
String (8) "Is_const"
["Constant"]=>
&int (1)
}
["OP2"]=>
Array (3) {
[' Type ']=>
Int (1)
["Type_name"]=>
String (8) "Is_const"
["Constant"]=>
&int (1)
}
["Lineno"]=>
Int (1)
}
[1]=>
Array (7) {
["Address"]=>
Int (29981268)
["OpCode"]=>
Int (41)
["Opcode_name"]=>
String (Ten) "Zend_print"
["Flags"]=>
Int (770)
["Result"]=>
Array (3) {
[' Type ']=>
Int (2)
["Type_name"]=>
String (Ten) "Is_tmp_var"
["Var"]=>
Int (1)
}
["OP1"]=>
Array (3) {
[' Type ']=>
Int (2)
["Type_name"]=>
String (Ten) "Is_tmp_var"
["Var"]=>
Int (0)
}
["Lineno"]=>
Int (1)
}
[2]=>
Array (7) {
["Address"]=>
Int (29981388)
["OpCode"]=>
Int (70)
["Opcode_name"]=>
String (9) "Zend_free"
["Flags"]=>
Int (271104)
["OP1"]=>
Array (4) {
[' Type ']=>
Int (2)
["Type_name"]=>
String (Ten) "Is_tmp_var"
["Var"]=>
Int (1)
["Ea.type"]=>
Int (0)
}
["OP2"]=>
Array (3) {
[' Type ']=>
Int (8)
["Type_name"]=>
String (9) "is_unused"
["Opline_num"]=>
String (1) "0"
}
["Lineno"]=>
Int (1)
}
[3]=>
Array (7) {
["Address"]=>
Int (29981508)
["OpCode"]=>
Int (62)
["Opcode_name"]=>
String (one) "Zend_return"
["Flags"]=>
Int (16777984)
["OP1"]=>
Array (3) {
[' Type ']=>
Int (1)
["Type_name"]=>
String (8) "Is_const"
["Constant"]=>
&null
}
["Extended_value"]=>
Int (0)
["Lineno"]=>
Int (1)
}
[4]=>
Array (5) {
["Address"]=>
Int (29981628)
["OpCode"]=>
Int (149)
["Opcode_name"]=>
String (zend_handle_exception)
["Flags"]=>
Int (0)
["Lineno"]=>
Int (1)
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.