如何管理生产和开发不同的php.ini设置? [英] How to manage different php.ini settings in production and development?

查看:279
本文介绍了如何管理生产和开发不同的php.ini设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有管理的php.ini配置从开发到生产的最佳实践?显然,这可以手动完成,但是这是容易出现人为错误。我想尝试并在版本控制生产文件,然后可能自动修改开发版本。 想法或意见我有过,我不知道他们是否是可行的:

  1. 在php.ini中包括 - 只包括在年底的开发设置 该文件?
  2. 来自Apache的conf
  3. 在有条件的负荷?
  4. 在编写一个脚本,在php.ini中的变化,获取生成phpdev.ini的动态版本 - (我知道这是可以做到)
  5. 显示错误
  6. 使用运行PHP的设置 - 我认为这有一定的局限性,因为如果脚本有致命错误,那么它不会运行,运行时设置
  7. 备份计划 - 保持量产版的SC,并手动更改 phpdev.ini因为需要必要的。然后,如果人工错误是由 他们在发展水平做了。
解决方案
  1. 存储你的ini在源$ C在他们的环境中而得名不同的目录$ C库:环境/ {开发,QA​​,分期,督促} /php.ini
  2. 在每一个环境下,做到这一点: RM /etc/php.ini中; LN -s /var/www/site/environments/prod/php.ini /etc/php.ini中

这样,你得到的版本控制的好处,不一定需要手动编辑每个。

Is there a best practice for managing php.ini configurations from development to production? Obviously it can be done manually, but that is prone to human error. I'd like to try and have the production file in version control and then possibly modify the development version automatically. Thoughts or ideas i've had which i dont know if they are feasible:

  1. php.ini includes - just include the dev settings at the end of the file?
  2. conditional loads from apache conf?
  3. write a script that when php.ini changes, a dynamic version of phpdev.ini gets generated - (i know this can be done)
  4. use runtime php settings for display errors - i think this has limitations because if the script has fatal errors, then it wont run the runtime setting.
  5. backup plan - keep the production version in SC, and manually change phpdev.ini as needed as needed. Then if manual mistakes are made they are done at the development level.

解决方案

  1. Store your ini in your source code repository in different directories named after their environments: environments/{dev,qa,staging,prod}/php.ini
  2. On each environment, do this: rm /etc/php.ini; ln -s /var/www/site/environments/prod/php.ini /etc/php.ini

This way, you get the benefits of revision control and don't necessarily have to edit each manually.

这篇关于如何管理生产和开发不同的php.ini设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆