How to set config=value in php.ini with Puppet?

mibutec picture mibutec · May 29, 2012 · Viewed 13.8k times · Source

I'm doing my first steps in Puppet and ran into a problem. I've installed PHP on a Linux server and I want to do some slightly changes to php.ini file. I don't want to overwrite the whole ini file with one from repository, just change/create one simple config value.

I want to ensure, that the property upload_max_filesize in php.ini has the value of 10M.

How can I achieve this?

Answer

mc0e picture mc0e · Aug 24, 2012

My preferred option would be to leave php.ini alone, and have puppet create a file in php's conf.d directory to override the values you want to change.

The less changes you make to php.ini, the easier it is to see what's going on when you need to merge your changes with the package providers changes when you upgrade php.ini in future.

file {'/etc/php5/conf.d/upload_limits.conf':
  ensure => present,
  owner => root, group => root, mode => 444,
  content => "post_max_size = 10M \nupload_max_filesize = 10M \n",
}