Language performance optimizations for PHP performance: vld--view Code opcode artifacts

Source: Internet
Author: User

VLD Introduction

VLD is a php extension of pecl (PHP extension and application repository), and now the latest version is 0.14.0(2016-12-18), which is to display the internal representation of the dump PHP script (opcode) ( Introduction to VLD from Pecl ). Simply put, you can see the PHP program's opcode.

  

  

Installation of the VLD extension

 1, download the official plug-in installation compression package

Official website: HTTP://PECL.PHP.NET/PACKAGE/VLD

    

Download command:# wget http://pecl.php.net/get/vld-0.14.0.tgz

Note: Download the URL is on the relative version of the link, right click, copy the link can

 2. Unpacking

Unpacking command:# tar zxvf vld-0.14.0.tgz

  3. Compiling and installing

Enter the extracted VLD directory:# CD vld-0.14.0/

    Extension PHP Extension:# phpize

Use locate to find Php-config path:# Locate Php-config

     Note: Locate command: "# Yum-y Install Mlocate" after the installation using "# UpdateDB" after updating data can be used directly

The php-config found are as follows:

      

Configure the php-config path of the compiled VLD:#./configure--with-php-config=/usr/bin/php-config--ENABLE-VLD

Compile and install:# make && make install

  4. Restart the server

Restart Apache:# systemctl Restart Httpd.service

Restart Nginx and PHP-FPM (restart if Nginx is available):

      # systemctl Restart Nginx.service

# systemctl Restart Php-fpm.service

Note: Systemctl is a new version of the CentOS system, there is no such command can use the following three commands instead

      # Service Apachectl Restart

# Service Nginx Restart

# service PHP-FPM Restart   

Testing for VLD extensions

Use the Phpinfo () function to test whether the installation was successful, Test Code:

<? PHP      Phpinfo ();? >

1, the use of network access results are as follows (display enabled):

      

2. Use command test (show enabled):

Command is:# php test.php | grep "VLD"

      

So, how do vld use pinch?

VLD cannot be used alone, it needs to be combined with PHP commands. Its main two parameters are -dvld.active (equals 1 proof is using VLD extension) and -dvld.execute (equals 1 proof is required to hold the PHP file, default is 1).

Test command:# php-dvld.active=1-dvld.execute=0 test.php

(means to run test.php, use VLD plug-in, do not execute, only show opcode)

  

Article for the author learned, there are flaws, please leave a message, thank you for your support! Please attach the link to this article for reprint.

Language performance optimizations for PHP performance: vld--view Code opcode artifacts

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.