Vagrant 如何通过Pecl和Puppet安装PHP APC

Vagrant 如何通过Pecl和Puppet安装PHP APC,vagrant,pear,puppet,pecl,Vagrant,Pear,Puppet,Pecl,我试图在Puppet上安装PHP APC,但我不知道如何进行?Pear已经安装好了,当我尝试执行安装PHPAPC的命令时,出现了一条错误消息 pecl.pp: class php::pecl { include php exec { "pecl install php-apc": require => Package["php-pear"] } } pear.pp: class php::pear { include php # upgrade

我试图在Puppet上安装PHP APC,但我不知道如何进行?Pear已经安装好了,当我尝试执行安装PHPAPC的命令时,出现了一条错误消息

pecl.pp:

class php::pecl {
    include php
     exec { "pecl install php-apc":
    require => Package["php-pear"]
    }
}
pear.pp:

class php::pear {
  include php

  # upgrade PEAR
  exec { "pear upgrade":
    require => Package["php-pear"]
  }

  # install PHPUnit
  exec { "pear config-set auto_discover 1":
    require => Exec["pear upgrade"]
  }




  # create pear temp directory for channel-add
  file { "/tmp/pear/temp":
    require => Exec["pear config-set auto_discover 1"],
    ensure => "directory",
    owner => "root",
    group => "root",
    mode => 777
  }

  # discover channels
  exec { "pear channel-discover pear.phpunit.de; true":
    require => [File["/tmp/pear/temp"], Exec["pear config-set auto_discover 1"]]
  }

  exec { "pear channel-discover pear.symfony-project.com; true":
    require => [File["/tmp/pear/temp"], Exec["pear config-set auto_discover 1"]]
  }

  exec { "pear channel-discover components.ez.no; true":
    require => [File["/tmp/pear/temp"], Exec["pear config-set auto_discover 1"]]
  }

  # clear cache before install phpunit
  exec { "pear clear-cache":
    require => [Exec["pear channel-discover pear.phpunit.de; true"], Exec["pear channel-discover pear.symfony-project.com; true"], Exec["pear channel-discover components.ez.no; true"]]
  }

  # install phpunit
  exec { "pear install -a -f phpunit/PHPUnit":
    require => Exec["pear clear-cache"]
  }

  # install apc
  exec { "pear install -a -f pear/php-apc":
    require => Exec["pear clear-cache"]
  }


}
php init.pp类:

class php {

  # package install list
  $packages = [
    "php5",
    "php5-cli",
    "php5-mysql",
    "php-pear",
    "php5-dev",
    "php5-gd",
    "php5-mcrypt",
    "libapache2-mod-php5",
  ]

  package { $packages:
    ensure => present,
    require => Exec["apt-get update"]
  }
    }
错误消息:

err: /Stage[main]/Php::Pear/Exec[pear install -a -f pear/php-apc]/returns: change from notrun to 0 failed: pear install -a -f pear/php-apc returned 1 instead of one of [0] at /tmp/vagrant-puppet-1/modules-0/php/manifests/pear.pp:52
err: /Stage[main]/Php::Pecl/Exec[pecl install php-apc]/returns: change from notrun to 0 failed: pecl install php-apc returned 1 instead of one of [0] at /tmp/vagrant-puppet-1/modules-0/php/manifests/pecl.pp:5

我建议您使用一个经过尝试和信任的puppet模块,它可以为您安装PHP和pecl扩展

看看下面的木偶模块,它很可能会有所帮助


事实证明,该包实际上被称为apc,而不是php apc-doh

工作代码:

  exec { "pecl install apc":
    require => Exec["pear clear-cache"]
  }

错误消息是什么?err:/Stage[main]/Php::Pear/Exec[Pear install-a-f Pear/Php apc]/returns:notrun改为0失败:Pear install-a-f Pear/Php apc返回1,而不是/tmp/vagrant-puppet-1/modules-0/Php/manifests/Pear.pp:52 err:/Stage[main]/Php::Pecl/Exec[Pecl install-Php apc]/返回:从notrun更改为0失败:pecl安装php apc返回1,而不是/tmp/vagrant-puppet-1/modules-0/php/manifests/pecl.pp:5处的[0]之一