PHP source encryption, Zend Guard and Ioncube

Source: Internet
Author: User
Tags configuration php php language php source code ioncube

Today in the customer server, the installation of products found that the customer's PHP source code is encrypted with Ioncube, and we use Zend Guard, installed Zend Optimizer after the discovery of conflict.

Here is a comparison of the two encryption tools seen on the web.

I. Overview
PHP Codebelongs to open source WEBCode, does not need to compile, belongs to the explanatory type language。 (that is, an interpreter that appends the appropriate extension to the webserver to complete the parsing of the code).
Based on the PHP language interpretation type features, combined with a ProjectRequirements, we can use Php.exe (PHP interpreter) to interpret the PHP code Application, making PHP applicable not only to the Web environment but also to local processing, such as GTK.
I have a project in my hand. Use the Delphi Channel (PIP) method to invoke the Phpexe interpreter, explaining the PHP code to complete the process in the Web.
But on the other hand the drawbacks are reflected, because PHP uses Open Source, different users can easily see the source program written in the PHP language, the source program analysis, easy to get data connection, processing process, and even Serverand other important information, the same is not conducive to Software DevelopmentCopyright protection of the business. Therefore, the PHP source code must be encrypted authorization processing, i.e. (encode and license authorization)
There are two main types of software that are currently on the market that are more popular for PHP encryption authorization:
(1) ZendThe company's Zendguard. -The current most NewBen 5.0.1 (2008/06/17)
(2) IoncubeThe company's Ioncube PHP Encode. --Current Latest version 6.5 (2008/06/17)
For these two more commonly used encode software, they have different functionWith the respective merits.

Second, Zend Guard
Zend Guard can only encrypt files with PHP tags or source code (such as. Php,inc, etc.), for other files that do not have PHP tags saved by the text method can not be encrypted operation, support period, registration code.
Supports php4.2.x~5.2.x version of encryption.
Using the Zendoptimizer (PHP engine) can improve the source 20~50% above the speed optimization, combined with zendguard can be increased to more than 50% performance speed optimization, and Zendoptimizer can be installed in the current more mainstream The system . (You can choose the Zendoptimizer version for more optimizations when using Zendguard encryption), and Zendguard can only be used for environments configured with Zendoptimizer and cannot run independently. (Must be configured in the php.ini file)

* Also noteworthy is zendguard in the PHP4 error, for PHP4 absolute path and relative path in the encryption will have a big difference.

In the PHP4.4.1 environment, the following two files are available:
test.php

Reference:

<?php
Require_once ("inc/test1.php");
?>

inc/test1.php

Reference:

<?php
Echo Realpath (DirName (__file__));
?>

Without encryption, the result is: C:/localweb/zendtest/inc
But after encryption, it shows: C:/localweb/zendtest-encode/zendtest

You can see that after Zendguard encryption, the INC directory is removed, showing the address of the file that was included. (That is, __file__ is shown as a temporary constant).
* This issue has been tested and has not been detected in the PHP5.2.6 environment.

Third, Ioncube PHP Encode
Ioncube PHP Encode, developed by Ioncube, is used to encrypt PHP or non-PHP files. Ioncube in the functional aspects of the test can be superior to the Zend Company's Zendguard, not only support the term, registration code, and other encryption methods, but also support the IP,MAC address and other complex encryption methods. In addition, for Ioncube can not only encrypt php files with PHP tags or source code can also be non-php files stored in the text of the file to encrypt operations, such as XML,JS,CSS. (However, read-write operations must be performed using the reading API provided by Ioncube.) )
Encrypted PHP version from php4.0.6~5.2.x (up to 2 levels higher than Zendguard)
Ioncube and Zend, in order to improve PHP performance optimization also provides the corresponding PHP engine, can provide PHP optimization for most operating systems , but unfortunately, the version of the PHP engine has not been provided.
For the previous zendguard in the PHP4 environment, the path problem, in the Ioncube did not appear, you can see ioncube relatively stable.
For Ioncube, the file with PHP tags or source code is compressed encryption processing, for non-PHP text class files are encrypted. You must use "ioncube_read_file/ioncube_write_file" to read and write files when reading. Therefore, before using ioncube encryption, the corresponding PHP code needs to be modified before it can be used.

Iv. comparative results of Zend Guard and Ioncube
The following comparison results are the results of individuals who do not act as legal parties according to self-judgment.

Compare items

Zendguard

Ioncube PHP Encode

Compare results
Strengths

PHP version php4.2.x~5.2.x php4.0.6~5.2.x Ioncube
PHP engine Zendoptimizer
(Support for mainstream systems)
Ioncube PHP Accelerator
(does not include the mainstream system of Windows)
Zendoptimizer
Supported file formats Php,inc or only files containing PHP tag code can be encode.

PHP,INC,XML,JS,.CSS can be processed for all files saved as text. Encode encryption (binary) for PHP and files containing PHP tags.

The non-PHP file is encrypted with encrypt (encrypted side). However, it is required to use the API that it provides when it is read into the file for decryption.

Ioncube
IP Address Encryption Not supported Support Ioncube
Physical MAC Encryption Not supported Support Ioncube
Authorization control Support Support Zendoptimizer
Code time limit Support Support Zendoptimizer
Sales price
(Encryption software)
$600 USD 5160 (RMB) About 5850 yuan (RMB) Zendoptimizer
Engine price Free Free Zendoptimizer
PHP4 and PHP5 encryption compatibility issues A path issue occurs after encryption does not produce a path problem Ioncube
Configuration conditions Need to configure the php.ini file to run under the corresponding Optimizer (1) Fixed mode, configuration php.ini file;
(2) Binding method, automatic binding and decryption when encrypting the DLL file (generate Ioncube directory) does not need to configure the php.ini file.
Ioncube

It can be seen that there are pros and cons for Ioncube and Zendguard, so you need to decide which tool to use when choosing a product, depending on the project and the code.

PHP source encryption, Zend Guard and Ioncube

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.