Vagrant and Chef: How to install a newer version of PHP?

I am relatively new to using Vagrant and Chef . I am currently running Ubuntu Lucid 64 and using the Opscode PHP cookbook , which by default sets PHP 5.3.2 as a package. I would like to install PHP 5.3.8 or 9 (either from the source or as a package), but I cannot figure out how to configure it correctly. I copied the dependent cookbooks (build-essential, xml, mysql). This is what I still have:

# vagrant_main/recipes/default.rb require_recipe "apt" node.override["php"]["version"] = "5.3.9" require_recipe "php::source" 

But I get an error message. The following are the relevant stack trace lines:

 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' 

Update: If I tell you a PHP recipe so as not to worry about MySQL, it seems to be fine ...

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

... however, Apache does not seem to know which version of PHP is working. php_info() reports that it is using PHP 5.3.2, but the command line ( php -v ) correctly reports 5.3.9.

What am I doing wrong?

+7
source share
1 answer

In /etc/apache2/mods-enabled/php5.load you can determine which version of php Apache will use (it must be installed).

+2
source

All Articles