example42 / puppet-php

A puppet module for php. According to Example42 NextGen spec.
Other
45 stars 62 forks source link

cannot set both source and template on node X #75

Closed choonchernlim closed 9 years ago

choonchernlim commented 9 years ago

I had successful experience getting this module to work on Ubuntu, but I am having problem trying to get it to work on RHEL 6.

I tried to configure using the default: class { 'php': }

The error I'm getting is this:-

Error: PHP: cannot set both source () and template () on node X
Error: PHP: cannot set both source () and template () on node X

I read init.pp and the error seems to be happening on this:-

  if ($php::source and $php::template) {
    fail ("PHP: cannot set both source and template")
  }

When I inspected these values, both are empty strings. So I decided to comment out that check and set both $manage_file_source and $manage_file_content to undef, but then I get error about $php::source_dir being empty when trying to create php.dir.

This is getting very frustrating. It works flawlessly on Ubuntu, but I can't cannot replicate my success on RHEL. I'm running Puppet 3.7.3 on RHEL 6, by the way.

LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Red Hat Enterprise Linux Server release 6.5 (Santiago)
``
Any idea why this is happening? Thank you.
alvagante commented 9 years ago

Are you using Puppet with future parser enabled?

choonchernlim commented 9 years ago

Yes, I did. I also enabled future parser when running on Ubuntu, and that works just fine.

alvagante commented 9 years ago

Uhm, even if it seems you have it enabled also on Ubuntu , I think the issue is related to future parser. Are you using the same Puppet version on Ubuntu and Centos? What happens on Centos if you disable the future parser?

Core reason could be that on Puppet 4 / future parser (don't know since which version) an empt string evaluates as true, while before it was evaluated as false.

Saying this without having tested that or having looked with care at the code

choonchernlim commented 9 years ago

Thank you for the explanation. I decided not to use future parser at this moment in attempt to get this installation to work.

I currently have the following:-

  class { '::php': }

  php::module { "enchant": }
  php::module { "ldap": }
  php::module { "gd": }
  php::module { "mysql": }

It seems to install fine, but the modules for some reason are not enabled. I did php -m and I'm seeing this:-

[PHP Modules]
bz2
calendar
Core
ctype
date
ereg
exif
filter
ftp
gettext
gmp
hash
iconv
libxml
openssl
pcntl
pcre
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
tokenizer
xml
zlib

[Zend Modules]

The /etc/php.ini exists, but an empty file. There's no /etc/php.d directory.

What did I do wrong? Thank you.

choonchernlim commented 9 years ago

It appears to me that I have to manually add the following to /etc/php.ini to get the modules to work:-

extension=enchant.so
extension=ldap.so
extension=gd.so
extension=mysql.so

Am I missing some puppet configurations above to have the listed modules autoloaded?

Thank you.

alvagante commented 9 years ago

You are right, the php::module defines just installs the relevant package but does not ensures it's enabled at the configuration level (some packages on some OS do that, others don't...). I suppose we can add a parameter that allows option to create such files.

choonchernlim commented 9 years ago

That's a bummer. I believe Ubuntu added them for me, but it looks like that doesn't work on RHEL 6.

A feature like that would be great.

I tried php::augeas, it only allow me to add just one extension line.

vitxd commented 9 years ago

same problem here on Centos 7, I can't really get around it, even specifying either source or template. If I try with Centos 6.5 it works (using puphpet scripts)

ddeboer commented 9 years ago

Core reason could be that on Puppet 4 / future parser (don't know since which version) an empt string evaluates as true, while before it was evaluated as false.

Saying this without having tested that or having looked with care at the code

This is exactly right: Puppet 3.7 future/Puppet 4 interprets empty strings as true.

ranjeetkgupta commented 9 years ago

Hi folks . I have run into the same problem. "Error: PHP: cannot set both source () and template () on node X"

I am using future parser on PE 3.8. I cant switch off the future-parser as I am using 'collection.each{}' construct in a different manifest. Is there a work-around for this ? I am using centos 6.6

sylvainraye commented 9 years ago

Just to confirm you that the parser = future make me trouble with the source and template condition on puppet 3.8. Removing it fix it. However I cannot use anymore the each feature of puppet future

andrewhertog commented 9 years ago

See pull request: https://github.com/example42/puppet-php/pull/96

alvagante commented 9 years ago

PR #96 merged issue should be fixed