Vagrant和Chef:如何安装更新版本的PHP?

And*_*rew 7 php chef-infra vagrant

我使用VagrantChef比较新.我目前正在运行Ubuntu Lucid 64并使用默认情况下安装PHP 5.3.2 的Opscode PHP cookbook作为软件包.我想安装PHP 5.3.8或9(从源代码或作为一个包),但我似乎无法弄清楚如何正确配置它.我复制了依赖的cookbook(build-essential,xml,mysql).这是我到目前为止:

# vagrant_main/recipes/default.rb

require_recipe "apt"

node.override["php"]["version"] = "5.3.9"
require_recipe "php::source"
Run Code Online (Sandbox Code Playgroud)

但是我收到了一个错误.以下是堆栈跟踪的相关行:

NameError: wrong constant name DebianBeforeSqueeze?
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/recipe_definition_dsl_core.rb:56:in `const_defined?'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/recipe_definition_dsl_core.rb:56:in `method_missing'
/tmp/vagrant-chef-1/chef-solo-1/mysql/recipes/client.rb:26:in `from_file'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/cookbook_version.rb:578:in `load_recipe'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/language_include_recipe.rb:40:in `include_recipe'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `each'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `include_recipe'
/tmp/vagrant-chef-1/chef-solo-1/php/recipes/source.rb:25:in `from_file'
Run Code Online (Sandbox Code Playgroud)

更新:如果我告诉PHP配方不要担心MySQL,它似乎安装好...

node.override["php"]["version"] = "5.3.9"
node.override["php"]["configure_options"]["mysql"] = false
require_recipe "php::source"
Run Code Online (Sandbox Code Playgroud)

...但是,Apache似乎不知道它运行的是哪个版本的PHP.php_info()报告称它使用PHP 5.3.2,但命令行(php -v)正确报告5.3.9.

我究竟做错了什么?

Mat*_*bík 2

您可以确定/etc/apache2/mods-enabled/php5.loadApache 将使用哪个版本的 php(必须安装)。