2012-01-17 88 views
7

我比較新使用VagrantChef。我目前正在運行Ubuntu Lucid 64,並且默認使用安裝PHP 5.3.2的Opscode PHP cookbook作爲軟件包。我想安裝PHP 5.3.8或9(無論是從源代碼還是作爲一個包),但我似乎無法弄清楚如何正確配置它。我已經複製了相關的食譜(build-essential,xml,mysql)。這是我到目前爲止:流浪和廚師:如何安裝更新版本的PHP?

# vagrant_main/recipes/default.rb 

require_recipe "apt" 

node.override["php"]["version"] = "5.3.9" 
require_recipe "php::source" 

但我得到一個錯誤。下面是堆棧跟蹤的相關線路:

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' 

更新:如果我告訴了PHP食譜不用擔心MySQL的,它似乎安裝罰款...

node.override["php"]["version"] = "5.3.9" 
node.override["php"]["configure_options"]["mysql"] = false 
require_recipe "php::source" 

.. 。但是,Apache似乎並不知道它運行的是哪個版本的PHP。 php_info()報告它使用PHP 5.3.2,但命令行(php -v)正確報告5.3.9。

我在做什麼錯?

+0

我對Vagrant沒有經驗,但完全有可能在你的系統上有不同版本的PHP(cli變體的一個版本,以及另一個web服務器中的CGI模塊),我認爲這是atm的情況。 – Wrikken 2012-01-18 00:31:39

回答

2

/etc/apache2/mods-enabled/php5.load你可以確定哪個版本的PHP將Apache使用(它必須安裝)。

+0

我很久沒看過這個了,但我敢打賭這是個問題。我敢打賭,當我安裝了Apache PHP模塊時,由於CLI版本正確,因此沒有指定正確的PHP版本。 – Andrew 2013-01-21 18:19:50