Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'20-apc.ini' formatted ini files #32

Open
basvanmeurs opened this issue May 12, 2014 · 5 comments
Open

'20-apc.ini' formatted ini files #32

basvanmeurs opened this issue May 12, 2014 · 5 comments

Comments

@basvanmeurs
Copy link

On debian, the ini files are named as '20-apc.ini' (they have a priority number).

When using your module, files are always created as 'apc.ini' and there is no way to change this.

Example:
php::module::ini { 'apc':
settings => {
'apc.enabled' => '1',
'apc.shm_segments' => '1',
'apc.shm_size' => '128M',
}
}

Produces '/etc/php5/conf.d/apc.ini'. Installing packaging php-apc already produced the file '/etc/php5/conf.d/20-apc.ini' with just the following line: extension=apc.so

Netto effect: 2 files in the config directory and messages such as "PHP Warning: Module 'apc' already loaded in Unknown on line 0" when running the php command.

Proposed solution: allow to specify the output ini filename.

@basvanmeurs
Copy link
Author

Patch on master branch (patch-php_module_ini-filename-param.diff):

diff --git a/manifests/module/ini.pp b/manifests/module/ini.pp
old mode 100644
new mode 100755
index 9069781..ea53f4e
--- a/manifests/module/ini.pp
+++ b/manifests/module/ini.pp
@@ -19,6 +19,7 @@ define php::module::ini (
   $pkgname  = false,
   $settings = {},
   $zend     = false,
+  $filename = "${title}.ini",
 ) {

   include '::php::params'
@@ -42,11 +43,11 @@ define php::module::ini (

   # INI configuration file
   if $ensure == 'absent' {
-    file { "${::php::params::php_conf_dir}/${modname}.ini":
+    file { "${::php::params::php_conf_dir}/${filename}":
       ensure => absent,
     }
   } else {
-    file { "${::php::params::php_conf_dir}/${modname}.ini":
+    file { "${::php::params::php_conf_dir}/${filename}":
       ensure  => $ensure,
       require => Package[$ospkgname],
       content => template('php/module.ini.erb'),

@thias
Copy link
Owner

thias commented May 12, 2014

Are most/many files using a single prefix number? Because it could be simpler if params.pp specified that default prefix for Debian, with the ability to override it when a different value is needed, and disabled the feature for RedHat.

@basvanmeurs
Copy link
Author

Hi thias, it is not a fixed prefix. The number indicates the priority so has a meaning. See http://superuser.com/questions/564995/what-is-the-php-config-ini-files-prefix-good-for for some more info.

@3flex
Copy link
Contributor

3flex commented Jul 24, 2014

Hi @basvanmeurs, which version of Debian are you using? According to the file list for php-apc package, on squeeze the file path is /etc/php5/conf.d/apc.ini and wheezy it is /etc/php5/mods-available/apc.ini.

See https://packages.debian.org/squeeze/amd64/php-apc/filelist and https://packages.debian.org/wheezy/amd64/php-apc/filelist

@jshholland
Copy link

@3flex the prefix is added when the ini file is symlinked in by the /usr/sbin/php5enmod script (here), which is run after installation. Thus it doesn't show up in the filelist, but is added by the package after install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants