开发者

How can I cache or evalute a modified version of PHP?

I have a modified version of PHP which is compiled to PHP, in PHP. I'm not interested in a discussion about why I shouldn't be doing this; best practice, standards, etc; so please don't.

It's not modified in the core, but crudely uses a PHP script to modify each PHP file before being evaluated. Because of the performance hit of modfiying each file, I am currently caching each file, however this is not an ideal solution becau开发者_如何学编程se:

  • Two copies of each file are stored
  • It's possible to modify the wrong file
  • Servers with crappy hosting don't allow file_put_contents(), so the cache has to be updated on the local server

An alternative solution is to evaluate each file at runtime, however this incurs an overhead and also requires eval(), which may be slower and doesn't give the same error messages as include().

I'd like to know if there's a better way to do this, preferably one that works on servers that don't allow file_put_contents().


Does your server have access to any shared memory caches? APC, memcache, etc? APC sounds like a decent fit for this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜