Manually filling opcode cache for entire app using apc_compile_file, then switching to new release.

Posted by Ben on Stack Overflow See other posts from Stack Overflow or by Ben
Published on 2010-05-14T14:35:07Z Indexed on 2010/05/14 16:14 UTC
Read the original article Hit count: 249

Filed under:
|
|
|
|

Does anyone have a great system, or any ideas, for doing as the title says?

I want to switch production version of web app-- written in PHP and served by Apache-- from release 1234 to release 1235, but before that happens, have all files already in the opcode cache (APC). Then after the switch, remove the old cache entries for files from release 1234.

As far as I can think of there are three easy ways of atomically switching from one version to the next.

  1. Have a symbolic link, for example /live, that is always the document root but is changed to point from one version to the next.
  2. Similarly, have a directory /live that is always the document root, but use

    mv live oldversion && mv newversion live

    to switch to new version.

  3. Edit apache configuration to change the document root to newversion, then restart apache.

I think it is preferable not to have to do 3, but I can't think of anyway to precompile all php files AND use 1 or 2 to switch release.

So can someone either convince me its okay to rely on option 3, or tell me how to work with 1 or 2, or reveal some other option I am not thinking of?

© Stack Overflow or respective owner

Related posts about apc

Related posts about php