【问题标题】:Vagrant and Chef: How to install a newer version of PHP?Vagrant 和 Chef:如何安装更新版本的 PHP?
【发布时间】:2012-02-12 17:57:12
【问题描述】:

我对使用VagrantChef 比较陌生。我目前正在运行 Ubuntu Lucid 64 并使用 Opscode PHP cookbook,它默认将 PHP 5.3.2 作为一个包安装。我想安装 PHP 5.3.8 或 9(从源代码或作为包),但我似乎无法弄清楚如何正确配置它。我已经复制了相关的说明书(build-essential、xml、mysql)。这是我目前所拥有的:

# 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。

我做错了什么?

【问题讨论】:

  • 我没有使用 Vagrant 的经验,但我认为您的系统上完全有可能拥有不同版本的 PHP(cli 变体一个版本,另一个版本是网络服务器中的 cgi 模块)自动取款机就是这样。

标签: php chef-infra vagrant


【解决方案1】:

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

【讨论】:

  • 我很久没看这个了,但我敢打赌这就是问题所在。我敢打赌,当我安装 Apache PHP 模块时,它没有指定正确的 PHP 版本,因为 CLI 版本是正确的。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-08-03
  • 1970-01-01
  • 2015-10-17
  • 2014-07-19
  • 1970-01-01
  • 2016-03-26
  • 1970-01-01
相关资源
最近更新 更多