Quote:
Originally Posted by TwistMyArm
Encoded scripts protected by SourceGuardian for PHP require loaders to run.
Can anyone explain this discrepancy for me please?
|
Encoding systems for PHP fall broadly into two types; those that trivially hide source code and rely on restoring it at runtime to process with calls to eval(), and those that compile to bytecode. PHP itself compiles to bytecode at runtime, and the compiled code systems take advantage of this to precompile code and protect the bytecode. SG is a compiled code system, and as with all such systems, a component
is needed on the server to process the code.
However, despite needing software on the server, SG and ourselves offer a feature that we call runtime installation as a way for the loading component to be installed on the fly from the user's own area as opposed to it being installed in the php.ini file. So not needing installation on the server actually means not needing to edit the php.ini file, which is how we word things in our blurb. This uses a feature in PHP called dl() that can install a module on demand. There are a few prerequisites for this to be possible, but in our experience it often is and it has been great for users on the shared hosts who may not like to install any additional modules themselves. Although Zend Optimiser isn't always popular with hosts because it can slow machines down and increase load, if you search forums such as
WHT, you'll find that hosts tend to support ionCube and Zend encoded files as standard or will add support if required.
There was a comment about SG using a Zend based engine. This is true, but not in its own component, and this is where we find some other distinctions. Compiled code systems themselves break down into two sub categories; those that restore compiled code to be processed by the standard opensource engine, and those that contain their own engine. SG and most others restore native bytecode, which is simple to do but does nothing to hide the bytecode, and Zend and ionCube use their own execution engines that are derived from the standard engine but where additional features have been added. In our case we use this to do things such as keeping the bytecode away from the standard PHP function table and to allow the execution engine to execute mangled bytecode rather than native bytecode. Zend use a modified engine in part as the bytecode is extended to support some of the code optimisations.
Other benefits that come from encoding include being able to create license files or to restrict the files themselves. For example you might want to make files stop working after a certain time, or to make them usable only on particular machines.
The original poster asked about protecting PHP, but what about template files, XML and other metadata? If you have them then it can be useful to protect those files too, and you'll find some products offer that type of feature as well. We were the first to introduce the idea back in Jan 2006, and possibly some other encoding products have followed our lead with this since. To decrypt the encrypted files you would call a Loader API function from an encoded PHP file, and for completeness, we added a way to encrypt data too so that you could write back encrypted config files for example. You may have heard of the popular template engine called Smarty, and we published a simple patch that shows how you can use both plain and encrypted templates with Smarty.
View the patch
As well as the obvious area of protecting code for sale, web developers can benefit from encoding as can website owners, particluarly those on shared servers where security is not always what it should be. Hope this info helps give some clarity, and if you have queries about encoding technologies then feel free to followup or get in touch directly and we'll be happy to help.