tutorials
tutorials copied to clipboard
Development mode vs. Production mode
First, forgive me if this is not the right place to discuss this matter or if this is considered as a noob question.
The difference between Development and Production mode is confusing for some of us (one example here: Can't see /album module URL but there are many others on stackoverflow.com).
Would it be possible to explain in the doc (here Development mode) how the cache is working in production. I mean if the only way to avoid the 404 error is to be in development mode or to overwrite the 'config_cache_enabled' => false
parameter in config/application.config.php
, how are we supposed to do to enable cache in production while avoiding the 404 error?
ZendSkeletonApplication is preconfigured to use zf-development-mode
to avoid this problem (details).
The source of the problem in #48 was that ZendSkeletonApplication was shipped with development mode disabled. In this mode ZF will generate cached snapshots of your application's entire configuration and write it to data/cache
so that subsequent requests don't have to re-compute the whole configuration on each request. After the first request (which generates the cache) all subsequent requests will use the cached data, so any changes you make to the configuration files (such as adding a new route) will not be used by the application until the cache is cleared (files in data/cache
deleted). ZendSkeletonApplication now ships with development mode enabled by default to prevent this problem.
I agree that the ZendSkeletonApplication and zf-development-mode could both use a little more documentation on why this is useful...as of now both just cover the how of production vs. development modes.
Since we're talking noob, I'm trying out Zend for the first time this evening, going through the Getting Started... tutorial. The experience is pleasurable.
OT: I noticed the installation once complete alerts the user she's in dev mode (using Composer, not sure about other methods); so I thought perhaps
/doc/book/getting-started/skeleton-application.md#development-mode
should be updated to reflect this? It doesn't need too much refactoring as a section, the info on the dev mode files and how the process of disabling dev mode removes them, can be retained, but just remove the instruction and explain dev mode is enabled by default.
Happy to do an edit on that. Whether any extra information about dev/production, specifically the why, could be added to this section too, I don't know.