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 because:
- 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()
.