JonBlog
Thoughts on website ideas, PHP and other tech topics, plus going car-free
PHP symlink deployment demo
Categories: Ideas, Outline

I’ve been reading up on build processes for PHP recently, and comparing them with the good and bad deployment approaches I’ve been asked to use in the past. To do it properly, there are two approaches designed for a speedy changeover:

  1. Build the app in a new location and then change the docroot symlink to point to the new path
  2. Build the app in a new location, rewrite the Apache vhost and perform a graceful reload

Someone once told me the symlink approach can cause problems: since it works at the file system level, a PHP app will happily load its classes without being aware of the change. Thus, some PHP requests will find themselves loading a mix of old and new libraries, with all the risk and unpredictability that brings.

Whilst I see how this problem occurs in theory, I’d imagine it would only be on high-traffic sites where this was likely to manifest. I’d therefore like to develop a demo that illustrates class loading when deploying via symlink change – can I get incompatible resources to load up by deploying a change in the middle of an PHP process load?

  • Use Apache’s ab for simulating load
  • Create a series of classes, each with a method named with the deployment number it comes from
  • Can I get disagreement from these methods?
  • Can I show that an Apache reload solves the problem?

 

Leave a Reply