[phpa] Doing compiled scripts properly

  • From: Nick Lindridge <nick@xxxxxxxxxxxxxxxxx>
  • To: phpa@xxxxxxxxxxxxx
  • Date: Sat, 22 Sep 2001 16:59:23 +0100

Actually, doing compiled scripts properly wouldn't 
be much of a change.  The first task is to have a way
to generate compiled files for an entire tree without
missing any. One way, and only a minor kludge, would
be to add an environment variable such as 
PHPA_NO_EXECUTE, and run the standalone php on each source
file. If PHPA_NO_EXECUTE was set, the accelerator would
skip execution of the scripts and just cache them.

In a new directory, you then create a copy of the source
tree directory structure, putting the corresponding 
cache files there instead of the source files, but 
with the source file names. A shell script could automate
this process easily.

When called to read a script, the first thing phpa does
is see whether there's an shm version. This step would
remain. If not it checks for a disc cached version. 
In this case there is, but just not in the place the 
accelerator expects it to be. Then it calls the 
default php behaviour. 

Instead, if there's no shm version, phpa could read 
the first 4 bytes of the source
file to determine whether it's actually a compiled file. If
it is then it calls the disc cache handler to use that
file instead of getting it from the cache directory, and
if not it would then call the default behaviour.

Nick

------------------------------------------------------------------------
  www.php-accelerator.co.uk           Home of the free PHP Accelerator

To post, send email to phpa@xxxxxxxxxxxxx
To unsubscribe, email phpa-request@xxxxxxxxxxxxx with subject unsubscribe


Other related posts:

  • » [phpa] Doing compiled scripts properly