PHP Code Protection--zend Guard Use _php Tutorial

Source: Internet
Author: User
Tags php source code
The role of Zend Guard is to use a compilation approach to protect PHP source code from being recompiled, unauthorized modification, unauthorized use, and re-posting. Moreover, it was developed by the owner of PHP, Zend, and is a completely custom-designed protector for PHP.
Below, please join me to learn to use Zend Guard, encryption to protect our PHP source code bar.
  
actual combat: Encrypt PHP source code
Download: http://www.zend.com/en/products/guard/
Next, let's prepare a simple PHP program test.php to test whether it can be protected by Zend Guard. The code for test.php is as follows:
Copy CodeThe code is as follows:
Phpinfo ();
?>

Open Zend Guard and click on the File menu to create a new project, shown in 1. Click Next to enter the directory and file add interface, because we just test a file, so click Add File to Test.php, then click Finish to build the project.
  
At this point, Zend guard automatically opens the newly created project, lists the files in the project on the left side of the interface, and lists information about the project on the right. Now we are ready to compile the source code. Click Encode (Compile) in the links on the right, and the console window at the bottom of the interface shows "the operation has completed successfully.", meaning that the compilation is complete.
Now go to the encrypted file to save the directory, you will see there is a test.php, it is the same as the original test.php it? Open it with the editing software and you can see that it is no longer the original content, as shown in 2. Note: You must save the original code, otherwise lost, even you have no way to view and modify.
  
Next Test the encrypted code, from the browser to access the encrypted PHP program, oops, error, not run, and display the information shown in 3. Originally, using Zend Guard encrypted PHP program, also need a partner-zend Optimizer, in order to normal execution and improve efficiency. Installation can be downloaded from http://www.zend.com/en/products/guard/. During the installation, the "Choose the PHP.ini folder" step indicates the location of the PHP configuration file php.ini on the system, "Choose the Web server's root folder" This step indicates where the Web server software is set up. After the installation is complete, open php.ini with Notepad, and at the end we will see configuration information similar to the following:
[Zend]
zend_extension_manager.optimizer_ts= "E:\Program files\zend\zendoptimizer-3.3.0\lib\optimizer-3.3.0"
zend_extension_ts= "E:\Program Files\zend\zendoptimizer-3.3.0\lib\zendextensionmanager.dll"
This means that Zend Optimizer has been installed successfully, we can restart the Web server software, let Zend Optimizer effective. Note: If the server you are using has been installed or contains Zend Optimizer, you will not have to install it again.
Now again from the browser to access the encrypted PHP program to try, sure enough to run correctly, from the information displayed, we can see Zend Optimizer information
Analysis of Zend Guard encryption principle
Let's take a look at the process and we can see the protection principle of Zend Guard at a glance. The PHP source code is compiled into cryptographic code via Zend Guard and then executed by PHP loaded with Zend Optimizer. Distributed to other people's program, is encrypted code, can be executed, but no source code, others can not be viewed and modified. Therefore, we can add the appropriate code in the program to detect the current time of the system to see if it exceeds the pre-set deadline, and if it is exceeded, the exit program will not be allowed to continue execution.

Zend Guard works like Java, and the compiled PHP program is like a compiled Java binary code that requires the support of the JVM to run, and Zend Optimizer can be seen as a PHP virtual machine. Zend Guard and Zend optimizer work together to compile encryption and execute post-compilation code.

The aspect of license management is a deeper use that can be used to generate license files to limit the use of programs by selecting different licensing models, such as the number of concurrent users, time limits, network fragmentation, or specific servers. Interested readers can look at the Help files that Zend Guard itself brings to understand the specific usage.

http://www.bkjia.com/PHPjc/327264.html www.bkjia.com true http://www.bkjia.com/PHPjc/327264.html techarticle the role of Zend Guard is to use a compilation approach to protect PHP source code from being recompiled, unauthorized modification, unauthorized use, and re-posting. And, it ...

  • Related Article

    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.