Re: Re: PHP compiler?
| From: | Manuel Lemos | Date: | Tue, 20 May 2003 02:30:40 +0000 |
| Subject: | Re: Re: PHP compiler? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148241@lists.php.net to get a copy of this message | ||
Hello,
On 05/19/2003 10:49 PM, daniel@electroteque.org wrote:
wow this sounds all interested i always thought an encoder was to "protect" the open source code , killaProtecting can mean many things. The more difficult your make it for somebody to take advantage of your code, the more protected your code is. Anyway, since PHP 4 the code is already compiled before is executed. The compiler is part of the Zend engine that ships with every copy of PHP. The results of the compiler are what is called Zend Op codes that some people call bytecodes like in the Java world. What the encoders do is to serialize the compiler results to a file the disk, ie, store the compilation Zend op codes in a stream of bytes in a cache file than can be loaded later, thus skipping the compiling phase on the next time the scripts are run. What the cache extensions do is practically the same except that instead of saving the serialized op codes to a disk file, they are saved to shared memory space that can be accessed by all Web server processes. So, loading from shared memory is faster than loading from encoded files which is also faster than recompiling the scripts on the next execution. Unlike what some people think, encoders do not use encryption because that would require the scripts to be decrypted before being run and that would be slow. That does not mean that encoders do not employ any sort of lightweight (possibly secret) encoding algorithm just to prevent things like strings to be stored in clear text. That is the part that usually is not disclosed about commercial encoders.
-- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/Hello, On 05/19/2003 10:07 PM, Ilkka Huotari wrote:Just an idea and a question. Will there be a PHP compiler available sometime in the future? I'm talking about a compiler, which could be used to make plain text script source into a binary format, and which php interpreter could interpret. The script parsing phase would be thus left out in the execution time. I think that software like Zend encoder and Ioncube encoder do this already. Actually as I think of it, it's a bit surprising that there is not a such compiler already in PHP distribution?Given that Zend Encoder is one of the sources of income of Zend and Zend people are leaders of the PHP Group, that should not be so hard to understand. ;-)How about PHP5, is it going to have this? When will it be out?What you are looking for is Turck extension. It was originally a cache extension but now is also a PHP bytecode optimizer and encoder and loader all in the same extension. It already supports encoding PHP 5 code. Notice that this is a real encoder much like Zend Encoder, not a source code encrypting tool. http://www.turcksoft.com/en/e_mmc.htm