<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>lighty's life: One more opcache for php (Preview)</title>
    <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>One more opcache for php (Preview)</title>
      <description>&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Yes, &lt;a href="http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview"&gt;another&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The preview version is deprecated. please check http://trac.lighttpd.net/xcache/wiki/GettingSource to get newer source.&lt;/p&gt;

&lt;p&gt;and report problems at http://trac.lighttpd.net/xcache/newticket&lt;/p&gt;
&lt;h2&gt;Introducing&lt;/h2&gt;

&lt;p&gt;I myself, have used &lt;a href="http://pecl.php.net/apc"&gt;apc&lt;/a&gt;, mmcache/&lt;a href="http://www.eaccelerator.net/"&gt;ea&lt;/a&gt;, &lt;a href="http://www.zend.com/"&gt;ZendOptimizer&lt;/a&gt;, 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. &lt;/p&gt;

&lt;p&gt;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...&lt;/p&gt;

&lt;h2&gt;Highlight spot of xcache&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;cacher, similar as other opcaches.&lt;/li&gt;
&lt;li&gt;opcode disassembler, to see how your scripts looks after they're compiled into opcode.&lt;/li&gt;
&lt;li&gt;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.&lt;/li&gt;
&lt;li&gt;php4.x lastest is stably supported, php5.x lastest just works, php6-devel is supported for your further vision.&lt;/li&gt;
&lt;li&gt;many more ...&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;New function for script&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;$ 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]])
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;other proto need documented.&lt;/p&gt;

&lt;h2&gt;How to install&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;$ wget http://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
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;take care about the output of make install
append the following to php.ini:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[xcache]
xcache.size = 64M
xcache.mmap_path = "/tmp/xcache"
xcache.cacher = 1
zend_extension="/usr/.../extensions/..../xcache.so"
# or
extension="xcache.so"
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Testing&lt;/h2&gt;

&lt;p&gt;restart your php (fastcgi or mod_php), check &lt;?php phpinfo() ?&gt; output for xcache status. if you see it there, you're done.&lt;/p&gt;

&lt;p&gt;and finally test the opcode dumper:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ ./phpdop.phpr ./phpdop.phpr
$ ./phpdc.phpr ./phpdc.phpr
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Patch for hardened source (not tested)&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;Index: processor.m4
===================================================================
--- processor.m4    (revision 27)
+++ processor.m4    (working copy)
@@ -575,6 +575,9 @@

    /* reserved */
    DONE(reserved)
+ #if defined(HARDENING_PATCH) &amp;amp;&amp;amp; HARDENING_PATCH
+   DISPATCH(zend_bool, created_by_eval)
+ #endif
    } while (0);
 ')
 dnl }}}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;it is suggested to modify processor/processor.m4 directly as there might be spaces lost in blog.&lt;/p&gt;</description>
      <pubDate>Tue, 04 Apr 2006 04:36:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:02d3d114-3e91-493c-bcd0-b1dad2f846d3</guid>
      <author>moo</author>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview</link>
      <category>lighttpd</category>
      <category>xcache</category>
      <trackback:ping>http://blog.lighttpd.net/articles/trackback/170</trackback:ping>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by mOo</title>
      <description>we have setup trac system at &lt;a href="http://trac.lighttpd.net/xcache/" rel="nofollow"&gt;http://trac.lighttpd.net/xcache/&lt;/a&gt;, you may report bugs with &lt;a href="http://trac.lighttpd.net/xcache/newticket" rel="nofollow"&gt;http://trac.lighttpd.net/xcache/newticket&lt;/a&gt;

include system version `uname -a`; php version `php -v` or check out phpinfo(), gcc version `gcc -v`</description>
      <pubDate>Fri, 19 May 2006 05:30:04 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:6e618fdc-2cd4-4544-bfdf-b94a451fa420</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-584</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by null</title>
      <description>fly# make
/bin/sh /usr/xcache-preview/trunk/libtool --mode=compile gcc  -I. -I/usr/xcache-preview/trunk -DPHP_ATOM_INC -I/usr/xcache-preview/trunk/include -I/usr/xcache-preview/trunk/main -I/usr/xcache-preview/trunk -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext  -DHAVE_CONFIG_H  -g -O2   -c /usr/xcache-preview/trunk/xcache.c -o xcache.lo
 gcc -I. -I/usr/xcache-preview/trunk -DPHP_ATOM_INC -I/usr/xcache-preview/trunk/include -I/usr/xcache-preview/trunk/main -I/usr/xcache-preview/trunk -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -DHAVE_CONFIG_H -g -O2 -c /usr/xcache-preview/trunk/xcache.c  -fPIC -DPIC -o .libs/xcache.o
In file included from /usr/xcache-preview/trunk/xcache.c:9:
/usr/include/malloc.h:3:2: #error " has been replaced by "
In file included from /usr/xcache-preview/trunk/xcache.c:21:
/usr/xcache-preview/trunk/align.h:16:1: warning: "ALIGN" redefined
In file included from /usr/include/sys/param.h:109,
                 from /usr/local/include/php/main/php.h:206,
                 from /usr/xcache-preview/trunk/xcache.c:12:
/usr/include/machine/param.h:79:1: warning: this is the location of the previous definition
/usr/xcache-preview/trunk/xcache.c:24:23: processor.h: No such file or directory
/usr/xcache-preview/trunk/xcache.c: In function `xc_entry_store_dmz':
/usr/xcache-preview/trunk/xcache.c:149: warning: assignment makes pointer from integer without a cast
*** Error code 1

Stop in /usr/xcache-preview/trunk.</description>
      <pubDate>Sun, 14 May 2006 16:26:02 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:00fce4b5-de2d-4af9-bc9a-b69c41f8171b</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-479</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by peterb</title>
      <description>Cannot get to run with NuSphere dbg.so extension with apache2 and php-5.1.4. Error report says DBG extension must be loaded before any other. Does not seem to matter what order I place the extension commands in php.ini. Anybody any experience of this?</description>
      <pubDate>Sat, 06 May 2006 21:57:36 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:bc55bc2c-02ed-4666-bc9b-7dc198fb02f9</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-359</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by moo</title>
      <description>i simply don't have enough experience on those compatibility. once the site is up, any patch is welcomed.</description>
      <pubDate>Fri, 28 Apr 2006 07:54:44 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:158f87cb-7dc9-4cb3-a179-b2908c44a90d</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-264</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by wedge</title>
      <description>yes, a bsd-compatible version would be very nice.</description>
      <pubDate>Mon, 24 Apr 2006 15:15:33 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:b27acc4c-338a-415b-aff9-e4a73820ef20</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-251</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by Jedi</title>
      <description>The m4/sed/awk scripts used to create the processor use non-standard GNU extensions.

Even the Makefile requies GNU Make.

It's why the package is tricky to build on BSD systems.</description>
      <pubDate>Sat, 22 Apr 2006 15:22:16 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:582b1136-72a2-41e9-beba-9eecb5ce639f</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-242</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by Rajib Roy</title>
      <description>Great man. Working fullproof with php, Thanks for this</description>
      <pubDate>Tue, 18 Apr 2006 16:55:05 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:2c84c8e9-36bb-452b-8e09-49a814951362</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-235</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by mOo</title>
      <description>autoconf, phpize, m4 is required. ctags is recomended but optional</description>
      <pubDate>Sun, 16 Apr 2006 05:07:41 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:8a8bee33-8a63-4291-b5b8-b5ffb094be81</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-233</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by ericj</title>
      <description>After exec phpize it really made "configure"
and then I exec
./configure --enable-xcache-disassembler
and
make
Some error message like this happened.
/root/src/xcache-preview/processor.c:1:28: processor_real.c: No such file or directory

why? My OS is FreeBSD 6.1 RC#1
</description>
      <pubDate>Fri, 14 Apr 2006 21:32:27 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:e737074e-954c-4c56-8dd0-505e41f63a89</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-231</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by ericj</title>
      <description>sorry , I saw that !
I should use phpize ..</description>
      <pubDate>Fri, 14 Apr 2006 21:23:21 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:350130e3-6a27-4b8d-ad8d-f626c3d442b4</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-230</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by ericj</title>
      <description>there is no "configure" such file in the xcache-preview.tar.gz?</description>
      <pubDate>Fri, 14 Apr 2006 21:21:16 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:d259ecc2-c217-4fd4-9935-0653f4a71d8f</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-229</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by moo</title>
      <description>created_by_eval is introduced by harded php patch.

and congratulation! you're the first user (not devel) protected by xcache's struct detection :)
it just stop instead of making a buggy xcache that is not for your version of php.</description>
      <pubDate>Wed, 12 Apr 2006 04:13:17 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:66c614e5-52ca-45e2-b224-ebba0f5a8c59</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-217</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by foo</title>
      <description>&lt;code&gt;
$ phpize
$ ./conf
$ make
(...snip...)
==== calc zend_op_array =================
expected:  type function_name scope fn_flags prototype num_args required_num_args arg_info pass_rest_by_reference return_reference refcount opcodes last size vars last_var size_var T brk_cont_array last_brk_cont current_brk_cont try_catch_array last_try_catch static_variables start_op backpatch_count done_pass_two uses_this filename line_start line_end doc_comment doc_comment_len reserved created_by_eval
missing :  created_by_eval
==== store HashTable =================
==== store zval =================
==== store zend_op_array =================
==== restore HashTable =================
==== restore zval =================
==== dprint HashTable =================
==== dprint zval =================
==== dprint zend_op_array =================
==== dasm HashTable =================
==== dasm zval =================
==== dasm zend_op_array =================
==== asm HashTable =================
==== asm zval =================
==== asm zend_op_array =================
make: *** [processor.out] Error 1
&lt;/code&gt;

&lt;p&gt;System info:
Slackware 10.0.0, GCC 3.3.4, PHP 5.1.2&lt;/p&gt;
</description>
      <pubDate>Wed, 12 Apr 2006 00:48:20 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:6467e942-2132-4d7c-9367-0386606baca5</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-214</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by mOo</title>
      <description>run phpize to build configure.

it is only a preview package. thank u guys for your time trying it out.</description>
      <pubDate>Tue, 11 Apr 2006 13:08:50 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:432e8073-4a5c-463e-981d-dfd48d3c6af5</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-211</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by refactored.net</title>
      <description>Sorry, I'm not very up-to-speed with linux. How would I create the ./configure file? I thought it was a script which ran through the process of switching on/off options for "make"?</description>
      <pubDate>Tue, 11 Apr 2006 09:29:27 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:d163253b-a2ef-4949-9c3f-1e032bbd1a27</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-210</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by moo</title>
      <description>./conf is just a example, so cat to read it. the u have to do ./configure yourself with options you decided. according one of the above comments, coverage have to be enabled due to a bug.</description>
      <pubDate>Tue, 11 Apr 2006 07:04:41 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:55ed0ca4-315f-415b-8564-f15775156c7f</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-209</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by refactored.net</title>
      <description>Tried to install using instructions above, but with no luck. "cat ./conf" simply echo's to screen. Am I possibly missing a package?</description>
      <pubDate>Mon, 10 Apr 2006 17:51:11 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:9633e3a5-d70e-4a67-92f4-53c4810dad2d</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-207</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by moo</title>
      <description>well, apc isn't the real reason i write another opcode cacher. i wrote it before i can't start it up. and i've used apc for a long time, already. and i've contribute many bug reports/patches to apc/ea too. and yes, apc WAS stable for php4. but some idea can't be done by simply writing patches. it might need a whole struct change, sometimes.</description>
      <pubDate>Sun, 09 Apr 2006 13:47:31 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:5fcf5d37-fb99-4e6f-9836-2a97311d6570</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-204</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by -HR</title>
      <description>Mmh, if you can't get APC to start on your setup why not file a bug/try to fix it rather that spawning a whole new project? I think this bug has already been reported: &lt;a href="http://pecl.php.net/bugs/bug.php?id=7141" rel="nofollow"&gt;http://pecl.php.net/bugs/bug.php?id=7141&lt;/a&gt;

A good opcode cache is a hell lot of work to maintain and since Yahoo uses APC I don't see it being left unmaintained so I see no compelling reason for creating a new one. Maybe your work would be more useful if you contributed to APC instead?</description>
      <pubDate>Sun, 09 Apr 2006 10:21:28 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:50c1f39b-23b7-46c0-819a-1d23d7e4d999</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-203</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by moo</title>
      <description>always run phpize to get configure file.

undefined symbol: xc_coveragedump_dir ... thanks for your feedback :)

one of the most important reasons to release (not only the preview version) and setup a site, is to attach more testers, make it more stable. there's too much left not released yet, such as a administration frontend, an coverage reader (read the dump and view in browser), an reallife testcase runner, and document! about all the functions (not just php function) in xcache (for user) and internal doc (for devel who's interested in the source code).


i can't get apc start up(warm up) on fastcgi+php4+smp, strace -p `pid of php` gives me bunch of flock/fcntl-lock</description>
      <pubDate>Sat, 08 Apr 2006 03:21:27 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:c31ce03d-c661-4e1a-91e1-67ee382f9f51</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-197</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by User</title>
      <description>When loading the extension (compiled exactly as in sample) got such 

PHP Warning:  Unknown(): Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20020429/xcache.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20020429/xcache.so: undefined symbol: xc_coveragedump_dir in Unknown on line 0

When I compile the ext with --enable-xcache-coverage the module loads fine just segfaults on any code execution..

Any notes on this?</description>
      <pubDate>Wed, 05 Apr 2006 17:56:35 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:80b1f08d-2ac2-467e-966b-4e569ec2082c</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-188</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by Mogrol</title>
      <description>There doesn't seem to be any configure file in the archive, or am I missing something?</description>
      <pubDate>Wed, 05 Apr 2006 10:03:41 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:d50c033c-4a62-421c-948e-7cc325bf2f75</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-185</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by foo</title>
      <description>APC works fine with both PHP 4 and PHP 5.  </description>
      <pubDate>Wed, 05 Apr 2006 03:42:36 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:64211ac6-d3dd-4ab9-88cd-62e1e0058159</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-179</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by refactored.net</title>
      <description>Another quick question - does this work with Zend Optimizer?</description>
      <pubDate>Tue, 04 Apr 2006 15:20:56 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:416b8dcd-b10c-4496-a9e6-692da1ddf690</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-177</link>
    </item>
    <item>
      <title>"One more opcache for php (Preview)" by moo</title>
      <description>me, moo, one of the lighttpd developers, wrote it, and have it online stable for a long time until i decide to release it. i'm going to setup a website for it, this is way the preview is here.
the reference to &lt;a href="http://xcache.sourceforge.net/" rel="nofollow"&gt;http://xcache.sourceforge.net/&lt;/a&gt; was wrong. although i've live with this name for a long time, i might change it if there's a better one.</description>
      <pubDate>Tue, 04 Apr 2006 12:20:37 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:50f0ecf8-d83b-49b1-9327-984ce736ce41</guid>
      <link>http://blog.lighttpd.net/articles/2006/04/04/one-more-opcache-for-php-preview#comment-176</link>
    </item>
  </channel>
</rss>
