I’m sure you use lighttpd because of performance and scalability, and many of you run php too. I’m please to introduce you another opcode cache for php.
The preview version is deprecated. please check //trac.lighttpd.net/xcache/wiki/GettingSource to get newer source.
and report problems at //trac.lighttpd.net/xcache/newticket
I myself, have used apc, mmcache/ea, ZendOptimizer, The only 3 choices before xcache. ab cache is too old and dead, saidly, before i use it. Every one of u write php script know them, and have one if them boost your php performance, because they’re good.
But “What? Why you just introduce another opcode cacher?” It take some time to explain … the short term: it give you one more choice. the long term: mmcache/ea is the most optimized php-opcache. ZendOptimizer isn’t pre-built on all platform – they release binary not source file. apc was stable on php4 but not works with php5, and now, is said works with php5 but php4 is left to desert…
Highlight spot of xcache
- cacher, similar as other opcaches.
- opcode disassembler, to see how your scripts looks after they’re compiled into opcode.
- grows as php grows, using automated discover scheme by the devel, and the new changes to xcache to catch up new php version is brought to you easily.
- php4.x lastest is stably supported, php5.x lastest just works, php6-devel is supported for your further vision.
- many more …
New function for script
$ grep proto *.c mixed xcache_get(string name) bool xcache_set(string name, mixed value [, int ttl]) mixed xcache_isset(string name) bool xcache_unset(string name) int xcache_inc(string name [, int value [, int ttl]]) int xcache_dec(string name [, int value [, int ttl]])
other proto need documented.
How to install
$ wget //blog.lighttpd.net/files/xcache-preview.tar.gz $ tar -zxf xcache-preview.tar.gz $ cd xcache-preview $ phpize $ cat ./conf $ ./configure --help $ ./configure --enable-xcache-disassembler $ make $ su # make install
take care about the output of make install append the following to php.ini:
[xcache] xcache.size = 64M xcache.mmap_path = "/tmp/xcache" xcache.cacher = 1 zend_extension="/usr/.../extensions/..../xcache.so" # or extension="xcache.so"
restart your php (fastcgi or mod_php), check <?php phpinfo() ?> output for xcache status. if you see it there, you’re done.
and finally test the opcode dumper:
$ ./phpdop.phpr ./phpdop.phpr $ ./phpdc.phpr ./phpdc.phpr
Patch for hardened source (not tested)
Index: processor.m4 =================================================================== --- processor.m4 (revision 27) +++ processor.m4 (working copy) @@ -575,6 +575,9 @@ /* reserved */ DONE(reserved) + #if defined(HARDENING_PATCH) && HARDENING_PATCH + DISPATCH(zend_bool, created_by_eval) + #endif } while (0); ') dnl }}}
it is suggested to modify processor/processor.m4 directly as there might be spaces lost in blog.