Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend framework: How to detect environment(dev/prod) in code

I use Zend_Mail component in my application for sending mails via SMTP protocol.

And I want to persist my messages to files when I'm in development environment(accordingly to application.ini).

How can I detect in my controller action whether it is development or production/staging environment?

like image 319
Nikita Fedyashev Avatar asked Mar 02 '10 01:03

Nikita Fedyashev


1 Answers

If you're using Zend_Application and the ini settings load correctly (meaning the enviroment variable is setup correctly in your .htaccess file), then just use the APPLICATION_ENV constant.

That will match whatever application.ini setting is used (because that's what determines the section).

like image 152
Tim Lytle Avatar answered Oct 01 '22 19:10

Tim Lytle