Reputation: 2913
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:
Upvotes: 2
Views: 2858
Reputation: 23102
I don't know exactly if this is what you're looking for, but personally I like to perform all non-security-necessary php.ini modifications via the apache virtualhost settings, e.g. a development virtualhost:
ServerName sb.local
ServerAlias sb.local
DocumentRoot /srv/some-site
php_value session.cookie_domain "sb.local"
php_value date.timezone "America/New_York"
php_value mbstring.func_overload 7
php_value default_charset "utf-8"
AddDefaultCharset utf-8
php_value session.gc_maxlifetime "990000"
php_value error_reporting 30711
# 30711 = E_ALL ^ E_NOTICE
php_value display_errors "On"
php_value display_startup_errors "On"
php_value log_errors "On"
php_value html_errors "On"
etc
Upvotes: 0
Reputation: 23259
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.
Upvotes: 2