Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Mongo cannot be found #52

Open
marcospassos opened this issue Mar 29, 2014 · 6 comments
Open

Mongo cannot be found #52

marcospassos opened this issue Mar 29, 2014 · 6 comments

Comments

@marcospassos
Copy link

Hello @example42!

First of all, thanks for sharing this useful module.

I'm facing some problems when trying to install the mongo extension:

$host_name = "bookess.dev"
$doc_root = "/var/www/bookess/web/"

group { 'puppet': ensure => present }
Exec { path => [ '/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/' ] }
File { owner => 0, group => 0, mode => 0644 }

file { "/dev/shm/bookess":
  ensure => directory,
  purge => true,
  force => true,
  owner => vagrant,
  group => vagrant
}

file { "/var/lock/apache2":
  ensure => directory,
  owner => vagrant
}

exec { "ApacheUserChange" :
  command => "sed -i 's/export APACHE_RUN_USER=.*/export APACHE_RUN_USER=vagrant/ ; s/export APACHE_RUN_GROUP=.*/export APACHE_RUN_GROUP=vagrant/' /etc/apache2/envvars",
  require => [ Package["apache"], File["/var/lock/apache2"] ],
  notify  => Service['apache'],
}

class {'apt':
  always_apt_update => true,
}

Class['::apt::update'] -> Package <|
    title != 'python-software-properties'
and title != 'software-properties-common'
|>

apt::key { '4F4EA0AAE5267A6C': }

apt::ppa { 'ppa:ondrej/php5-oldstable':
  require => Apt::Key['4F4EA0AAE5267A6C']
}

package { [
    'build-essential',
    'vim',
    'curl',
    'git-core',
    'mc'
  ]:
  ensure  => 'installed',
}

class { 'apache': }

apache::dotconf { 'custom':
  content => 'EnableSendfile Off',
}

apache::module { 'rewrite': }

apache::vhost { "${host_name}":
  server_name   => "${host_name}",
  serveraliases => [
    "www.${host_name}"
  ],
  docroot       => "${doc_root}",
  port          => '80',
  env_variables => [
    'VAGRANT VAGRANT'
  ],
  priority      => '1',
}

class { 'php':
  service             => 'apache',
  service_autorestart => false,
  module_prefix       => '',
}

php::module { 'php5-mysql': }
php::module { 'php5-cli': }
php::module { 'php5-curl': }
php::module { 'php5-intl': }
php::module { 'php5-mcrypt': }
php::module { 'php5-gd': }
php::module { 'php-apc': }

class { 'php::devel':
  require => Class['php'],
}

class { 'php::pear':
  require => Class['php'],
}

php::pear::module { 'PHPUnit':
  repository  => 'pear.phpunit.de',
  use_package => 'no',
  require => Class['php::pear']
}

php::pecl::module { 'mongo': }

php::pecl::module { 'xdebug': }

class { 'composer':
  command_name => 'composer',
  target_dir   => '/usr/local/bin',
  auto_update => true,
  require => Package['php5', 'curl'],
}

php::ini { 'php_ini_configuration':
  value   => [
    'date.timezone = "UTC"',
    'display_errors = On',
    'error_reporting = -1',
    'short_open_tag = 0',
    'memory_limit = 128M',
    'xdebug.default_enable = 1',
    'xdebug.remote_autostart = 0',
    'xdebug.remote_connect_back = 1',
    'xdebug.remote_enable = 1',
    'xdebug.remote_handler = "dbgp"',
    'xdebug.remote_port = 9000'
  ],
  notify  => Service['apache'],
  require => Class['php']
}
err: /Stage[main]//Php::Pecl::Module[mongo]/Package[php-mongo]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php5-mongo' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php5-mongo

I added the ppa manually but it didn't work:

apt::key { '4F4EA0AAE5267A6C': }

apt::ppa { 'ppa:ondrej/php5-oldstable':
  require => Apt::Key['4F4EA0AAE5267A6C']
}

apt::ppa { 'ppa:chris-lea/mongodb-drivers': 
    require => Apt::Key['4F4EA0AAE5267A6C']
}
err: /Stage[main]//Php::Pecl::Module[mongo]/Package[php-mongo]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php5-mongo' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php5-mongo : Depends: phpapi-20090626
E: Unable to correct problems, you have held broken packages.

Do you have any idea how can I solve that?

Thanks in advance.

@alvagante
Copy link
Member

It seems an issue related to the deb package and its dependency :
The following packages have unmet dependencies:
php5-mongo : Depends: phpapi-20090626

The define just tries to execute
/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php5-mongo
so the system must be in the condition of being able to run this command without issues,

@marcospassos
Copy link
Author

Hello @example42!

I executed the command and this is the result:

vagrant@precise64:/var/www$ sudo /usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php5-mongo 
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php5-mongo

Any suggestion?

@alvagante
Copy link
Member

How is called the php-mongo package name?
I might need to add a parameter that allows overrides of the computed name in:

  $real_package_name = $::operatingsystem ? {
    ubuntu  => "php5-${name}",
    debian  => "php5-${name}",
    default => "php-${name}",
  } 

@marcospassos
Copy link
Author

I just have made a research and I can't find any php mongo package for Ubuntu. The problem installing through pecl is that the extension does not get loaded. Looking into the log, I noticed the following warning:

[Sun Mar 30 14:55:20 2014] [notice] caught SIGTERM, shutting down
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/mongo.so' - /usr/lib/php5/20100525/mongo.so: cannot open shared object file: No such file or directory in Unknown on line 0

This is the puppet snippet:

php::pecl::module { 'mongo':
    use_package => "no",
}

php::ini { 'php_ini_configuration':
  value   => [
    'extension=mongo.so'
  ],
  notify  => Service['apache'],
  require => Class['php']
}

@marcospassos
Copy link
Author

Declaring service_autorestart => true seems to fix that. Do you know why?

@alvagante
Copy link
Member

Well, that parameter restarts the (apache) service and therefore enables changes in the configuration.

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

No branches or pull requests

2 participants