PHP Cache Correlation

Source: Internet
Author: User
Tags php source code

During PHP operation, the PHP engine will process the PHP source code (lexical analysis, parsing, etc.) and then generate opcode.

And then run it again. At this stage can be opcode cache up, when the next need to run the program, it avoids the lexical analysis, grammar analysis, directly take opcode to use.

Eaccelerator is such a program.

View php's opcode with VLD:

Http://pecl.php.net/package/vld/0.12.0/windows

In the above address download VLD, after decompression will Php_vld.dll, copied to the Ext directory.

Revise php.ini, add "Extension=php_vld.dll";

To view opcode, create a new PHP script that executes under CMD

"E:\xampp\php>php-dvld.active=1 e:\htdocs\mytest\n.php" command.

Show Results:

E:\xampp\php>php-dvld.active=1 e:\htdocs\mytest\n.phpFinding Entry Pointsbranch analysis from Position:0jump found . Position 1 = Position 2 = 6Branch analysis from Position:13return foundbranch analysis from Position:6jump found. Position 1 = 3Branch analysis from Position:3jump found.  Position 1 = 1Branch analysis from position:1filename:e:\htdocs\mytest\n.phpfunction name: (null) Number of OPS: 14compiled VARs:!0 = $iline # * OP fetch ext return operands------------------                                                   ---------------------------------------------------------------0 > ASSIGN !0, 0 1 > Is_smaller! 0, 2 ;                                         Jmpznz 6,->13 3 > Post_inc                                             !0 4 Free        5 > JMP->1 6 > CONCAT      ~ ' A ',!0 7 fetch_w local $4                                           ~ 8 ASSIGN $4,!0 9 CONCAT        "A",!0 Fetch_r local $7                                                      ECHO $7 > JMP  ->3 > > RETURN 1branch: # 0; line:30-30; sop:0; eop:0; Out1:1branch: # 1; line:30-30; Sop:1; Eop:2; Out1:13; Out2:6branch: # 3; line:30-30; Sop:3; Eop:5; Out1:1branch: # 6; line:31-33; Sop:6; Eop:12; Out1:3branCH: # 13; line:36-36; Sop:13; Eop:13path #1:0, 1, 13,path #2:0, 1, 6, 3, 1, 13,0123456789101112131415161718192021222324252627282930313233343536373 8394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 99

Install Eaccelerator:

Download: http://www.sitebuddy.com/php/accelerators/eaccelerator-windows-binaries

Download down the file after decompression, will dll file, PayPal to Ext

Modify PHP.ini, open

    [Eaccelerator]    zend_extension_ts= "C:/php/ext/eaccelerator.dll"       //path according to the actual situation    eaccelerator.shm_size= "+"       //According to the system memory to set , default 16M, can be changed to 64M    eaccelerator.cache_dir= "c:/php/temp"     //Front created buffer folder    eaccelerator.enable= "1"    Eaccelerator.optimizer= "1"    eaccelerator.check_mtime= "1"    eaccelerator.debug= "0"    Eaccelerator.filter= ""    eaccelerator.shm_max= "0"    eaccelerator.shm_ttl= "0"    Eaccelerator.shm_prune _period= "0"    eaccelerator.shm_only= "0"    eaccelerator.compress= "1"    eaccelerator.compress_level= "9"

To configure Redis:

Download http://www.redis.cn/download.html

After decompression there are two DLL files, all copied to the Ext directory. [I copied to ext, also prompted to find. The final copy to the Php.exe directory is no longer an error].

Modify PHP.ini

Add to

"Extension=php_igbinary.dll

Extension=php_vld.dll "

Restart Apache,phpinfo () to see if it starts.

Test Redis:

$redis = new Redis ();  $redis->connect ("192.168.0.110", "6379");  The PHP client sets the IP and port  //Store a value  $redis->set ("Say", "Hello World");  echo $redis->get ("say");     Should output Hello World    //Store multiple values  $array = Array (' first_key ' = ' first_val ',            ' second_key ' = ' second_val ', '            third_key ' = ' third_val ');  $array _get = Array (' First_key ', ' second_key ', ' Third_key ');  $redis->mset ($array);  Var_dump ($redis->mget ($array _get));  

 

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.