Scott Keck-Warren
Scott Keck-Warren

Reputation: 1952

Setting PHP settings in Zend Framework 2

I'm working myself through creating an app using Zend Framework 2 and one of the features I really liked was having the ability to set PHP settings based on the environment (mostly enabling the error displays in the devel environment). As far as I can tell from my limited research this feature doesn't yet (or won't) exist and you have to create a custom solution for it.

Am I wrong or is this the only solution as of ZF 2.0.2?

Upvotes: 0

Views: 1615

Answers (1)

EvanDotPro
EvanDotPro

Reputation: 1141

You're correct, as of 2.0.2, there is no "built-in" solution for this in ZF2. If you're using PHP config files, you can simply put the ini_set() calls there. I've outlined methods for doing environment specific configuration files on my blog: http://blog.evan.pro/environment-specific-configuration-in-zend-framework-2

At a quick glance, the solution on the link you provided should still work as of 2.0.2. Personally, I'd just put the ini_set() calls in my configs, as I said, instead of attaching an extra listener to the bootstrap event, an extra check for the config key, and a foreach loop, but that's the beauty of ZF2: If you're looking for an easy way to provide PHP settings via the config, there's a module for that!

Upvotes: 8

Related Questions