2

In my "Vagrant" file I have this line:

chef.add_recipe("php::module_apc")

But it gives me this error:

[2013-01-11T22:14:53+00:00] INFO: Processing package[php-apc] action install (php::module_apc line 34)
================================================================================
Error executing action `install` on resource 'package[php-apc]'
================================================================================
Chef::Exceptions::Exec
----------------------
apt-get -q -y install php-apc=3.1.7-1 returned 100, expected 0

Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/php/recipes/module_apc.rb

 33: when "debian"
 34:   package "php-apc" do
 35:     action :install
 36:   end
 37: end

Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/php/recipes/module_apc.rb:34:in `from_file'

package("php-apc") do
  retry_delay 2
  retries 0
  recipe_name "module_apc"
  action [:install]
  cookbook_name :php
  package_name "php-apc"
end
[2013-01-11T22:14:53+00:00] ERROR: Running exception handlers
[2013-01-11T22:14:53+00:00] ERROR: Exception handlers complete
[2013-01-11T22:14:53+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2013-01-11T22:14:53+00:00] FATAL: Chef::Exceptions::Exec: package[php-apc] (php::module_apc line 34) had an error: Chef::Exceptions::Exec: apt-get -q -y install php-apc=3.1.7-1 returned 100, expected 0
Chef never successfully completed! Any errors should be visible in the output above. Please fix your recipes so that they properly complete.

I'm also running this before:

chef.add_recipe("apt")

But it's no help either.

Any ideas how to fix this? Thanks a lot!

Btw, I'm using all cookbooks from OpsCode: https://github.com/opscode-cookbooks/

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
thasmo
  • 257
  • 2
  • 11
  • 1
    What repository are you getting php 5.4 from? Do they have a APC package against that version of PHP included in that repository? If they haven't built a package, then you can't install it. Extensions have to be compiled against the specific version of PHP you are running. – Zoredache Jan 11 '13 at 23:30
  • To be honest, I dunno. I've installed Vagrant, downloaded some of the opscode cookbooks and use them in my Vagrant file. Any idea where to look for the repository addresses? The exact name of the PHP version is 5.4.10-1~dotdeb.0, if that helps. Thanks! – thasmo Jan 11 '13 at 23:36
  • Ah, I probably used some chef cookbooks/recipes which use dotdeb to install the packages. And if I'm right, the comments tell me, that there's no up to date version of APC for PHP 5.4.10 yet, right? http://www.dotdeb.org/2012/12/30/php-5-4-10-and-php-5-3-20/ – thasmo Jan 11 '13 at 23:46
  • Repositories are defined in `/etc/apt/sources.list`, or files in ``/etc/apt/sources.list.d/`. You can also see what repository was used for a specific package by running the command `apt-cache policy {packagename}` – Zoredache Jan 12 '13 at 01:06
  • The repositories are the ones from dotdeb.org, but there seems to be no relevant APC package for PHP 5.4, if I'm right. But i've found a PECL directory on their servers which holds an APC version for PHP 5.4, I think: http://packages.dotdeb.org/dists/squeeze-php54/php5-pecl/binary-i386/ But I'm not sure how to install it. Using PHP Pear to install it tells me: "RuntimeError: Package apc not found in either PEAR or PECL." Any hints? Thanks a lot! – thasmo Jan 13 '13 at 17:12

3 Answers3

0

I just ran through the following test:

Vagrantfile runlist:

chef.run_list = [
  "recipe[apt]",
  "recipe[php::module_apc]"
]

Using Ubuntu 12.04, Chef 10.14.2, and the following cookbook versions:

  • apt (1.4.8)
  • php (1.1.0)
  • build-essential (1.3.2) (dependency)
  • xml (1.0.4) (dependency)
  • mysql (2.1.0) (dependency)
  • openssl (1.0.0) (dependency)

It runs completely through, and ends up with:

vagrant@apctest:~$ dpkg -l | grep php
ii  php-apc                         3.1.7-1                    APC (Alternative PHP Cache) module for PHP 5
ii  php5-common                     5.3.10-1ubuntu3.4          Common files for packages built from the php5 source
ii  php5-fpm                        5.3.10-1ubuntu3.4          server-side, HTML-embedded scripting language (FPM-CGI binary)

So:

I would suggest using up-to-date released cookbooks from the Community Site instead of the source from GitHub - the released versions are "stable" vs the repos that are in constant development.

Mike Fiedler
  • 2,162
  • 1
  • 17
  • 34
  • Thanks for your input. So you recommend using PHP 5.3 instead of PHP 5.4, which has not too many stable cookbooks yet? Thanks! – thasmo Jan 19 '13 at 22:15
  • I wold say: be informed about the cookbooks you use, and the versions they support. If someone writes a cookbook that supports installing PHP 5.4, it may only work for a subset of the "stable" cookbook's functionality. – Mike Fiedler Jan 20 '13 at 14:51
0

I could be wrong, but the error doesn't seem to be related to a version mismatch.

Log in to the box and run sudo apt-get update. Log out and see if you can provision with vagrant provision. Sometimes an update doesn't complete properly and just needs to be rerun.

If that doesn't work, log in and try sudo apt-get install php-apc=3.1.7-1 to see what the error is from apt.

xofer
  • 3,072
  • 12
  • 19
0

APC is integrated into the PHP-5.4+ bundle as standard module and need no installation as separate package like PHP-5.3 and earlier needs. Therefore an error is throwed when you try to install module that is already exists in the system.

Kondybas
  • 6,964
  • 2
  • 20
  • 24