Instead of manually changing the line in index.php to ‘development’ or ‘production’ every time you upload, or commit your changes to repository you can easily set the APPLICATION_ENV using Apache on your local development machine, and leave index.php to default to ‘production’ meaning you no longer have to modify index.php
I use MAMP Pro for local development on my Mac so it was as simple as:
- Open MAMP Pro and go to File -> Edit Template -> Apache httpd.conf
- Add the following line to the bottom of the file, click save and restart the servers
SetEnv APPLICATION_ENV development
This works because the Zend Framework application checks to see if the Environment Variable has already been set, and if it has it leaves it alone:
defined(’APPLICATION_ENV’) || define(’APPLICATION_ENV’, (getenv(’APPLICATION_ENV’) ? getenv(’APPLICATION_ENV’) : ‘production’));
You don’t need to do this on your server because your application will default to the production environment