I. My environment: Debian7 (wheezy) x64PHP5.4.4-14 (apt-get) Apache2.2.22 (same as above, non-source code compilation) II: Install vld. (# indicates that it is under root, which is not described below. wget is 0.11.2.) First, we use peclinstallchannel: pecl. php. netvld-0.10.1 installed once
I. My environment: Debian 7 (wheezy) x64 PHP 5.4.4-14 (apt-get) Apache/2.2.22 (same as above, non-source code compilation) II: Install vld. (# indicates that it is under root, which is not described below. wget is 0.11.2.) First, I installed it once with pecl install channel: // pecl.php.net/vld-0.10.1.
I. My environment:
Debian 7 (wheezy) x64
PHP 5.4.4-14 (apt-get)
Apache/2.2.22 (same as above, non-source code compilation)
Ii. Install vld)
First, I used pecl install channel: // pecl.php.net/vld-0.10.1 to install it once, and finally failed to make install. So another
# Wget http://pecl.php.net/get/vld
# Tar zxvf vld
# Cd vld-0.11.2
# Phpize
#./Configure
# Make install
Check whether vld. so exists in/usr/lib/php5/20100525.
3. Add it to php.
# Cd/etc/php5/mod-available go to the php Module Directory
# Touch vld. ini: Create a configuration file named vld. ini.
# Echo-ne "; configuration for php VLD module \ n; priority = 20 \ nextension =/usr/lib/php5/20100525/vld. so \ n "> vld. ini, I am relatively lazy here. The content is written directly. The vld. so file in it is the vld. so file after compilation.
# Cd/etc/php5/conf. d
# Ln-s ../mod-available/vld. ini 20-vld.ini make a soft link to vld. ini
#/Etc/init. d/apache2 restart apache.
4. Use vld
The example is very simple. Create two new PHP files and output one with., one with, and connected
1. php
2. php
Execute
# Php-dvld. active = 1 1.php
# Php-dvld. active = 1 2.php
Then you can see
root@debian:/home/www$ php -dvld.active=1 1.phpFinding entry pointsBranch analysis from position: 0Return foundfilename: /home/www/1.phpfunction name: (null)number of ops: 4compiled vars: noneline # * op fetch ext return operands--------------------------------------------------------------------------------- 1 0 > CONCAT ~0 'Hello', '+' 1 CONCAT ~1 ~0, 'world%21' 2 ECHO ~1 2 3 > RETURN 1branch: # 0; line: 1- 2; sop: 0; eop: 3path #1: 0,
root@debian:/home/www$ php -dvld.active=1 2.phpFinding entry pointsBranch analysis from position: 0Return foundfilename: /home/www/2.phpfunction name: (null)number of ops: 4compiled vars: noneline # * op fetch ext return operands--------------------------------------------------------------------------------- 1 0 > ECHO 'Hello' 1 ECHO '+' 2 ECHO 'world%21' 2 3 > RETURN 1branch: # 0; line: 1- 2; sop: 0; eop: 3path #1: 0, Hello world!root@debian:/home/www$
The above contains the Opcode information executed during PHP runtime, the number of executed operations, and the output of all variable sets (compiled vars ), there is also a PHP code line number that contains the execution operation, the number of executions (#), and the name of the executed operation (op ).
We focus on the number of key items, the number of op, and the execution sequence. Number of ops indicates the total number of operations performed at the Opcode level during code execution. The two files above are four times.
We can see that when 1.php is connected with ".", two CONCAT (connection call) and one ECHO call are used.
2. The CONCAT operation is not used when php executes the "," connection, and only ECHO calls are cheaper than CONCAT calls.
So here we can draw a simple conclusion that "," connection is faster than "." connection.
In practice, when writing PHP code, we need to consider whether empty is fast or isset. well, we can use VLD to check the number of OPS and what operations are performed, so that we can get the right option.
Some useful parameters:
-Whether dvld. active activates the VLD hook when PHP is executed. The default value is 0, indicating that the VLD hook is disabled. You can enable it with-dvld. active = 1. -Dvld. skip_prepend whether to skip php. the file specified by auto_prepend_file in the ini configuration file is 0 by default, that is, the contained files are not skipped and the intermediate code generated by the code in these included files is displayed. This parameter has one precondition: -dvld.exe cute = 0-dvld. does skip_append skip php. the file specified by auto_append_file in the ini configuration file is 0 by default, that is, the contained files are not skipped and the intermediate code generated by the code in these included files is displayed. This parameter has a precondition: -dvld.exe cute = 0 -dvld.exe cute whether to execute this PHP script. The default value is 1, indicating execution. You can use -dvld.exe cute = 0 to show only the intermediate code without executing the generated intermediate code. -Whether dvld. format is displayed in custom format. The default value is 0, indicating no. You can use-dvld. format = 1 to display data in a custom format. Here, the custom format output is based on the parameter interval specified by-dvld. col_sep-dvld. col_sep, which is valid only when the-dvld. format parameter is enabled. The default value is "\ t ". -Dvld. whether verbosity displays more detailed information. The default value is 1. The value can be 0, 1, 2, and 3, which is actually smaller than 0, but the effect is the same as that of 0, such as 0.1, except for a negative number, the negative number and the effect are the same as those of 3, and the effect is the same as that of 3. -Dvld. save_dir: Specifies the file output path. The default path is/tmp. -Dvld. save_paths controls whether to output files. The default value is 0, indicating no output file-dvld. dump_paths controls the output content. Currently, there are only 0 and 1 cases. The default value is 1. The output content