Monday, March 18, 2013

9:31 AM
If you write PHP scripts for clients, or perhaps sell PHP scripts, you may want to encode your PHP code or even just somehow obfuscate it so that others who have a copy of your script cannot modify them or copy your code or otherwise adapt it for use on machines that are not licensed to do so. 

Or perhaps you want to distribute a demo script that times out after a period of time. It is for such purposes that the PHP encoders and obfuscators listed here are useful. 

PHP encoders precompile your PHP source code into a binary code for execution with the help of an intermediate code interpreter. They are sometimes also called PHP accelerators, since they speed up the execution of your script by precompiling and caching it.  

PHP obfuscators, on the other hand, merely take your source code and change the names of your variables, constants and user-defined functions to obscure strings of characters. With obfuscators, your code remains in source code form and are actually fairly easily deciphered. 

Although not listed in the main section below, if you really need a PHP encoder and accelerator, I suggest that you get a commercial one which are vastly more effective, and have additional features like the ability for you to license your code to run only on certain domains, have an expiry date (very useful for demos for clients to try out before they pay for your software), etc. 

The two main commercial encoders around (in the sense that they are the ones that the majority of encoded commercial PHP programs use) are the IonCube PHP Encoder and Zend Guard.

Unlike some of the free programs, these encoders pre-compiles your PHP source code into binary code which can be executed on your client's machines with the help of additional programs called "loaders".  

IonCube also has an option where the binary code is further encrypted, making it even harder than ever to reverse engineer the code. Other features include the ability to create PHP scripts that will not be accidentally mangled by your users when they upload it using their FTP program. 

This is a problem with binary files that are given a PHP extension since almost all FTP programs assume that PHP files are text files, and so will automatically modify the text files when they upload it (to change the line endings).