Question

I am using Chef's community cookbooks, in particular the apt, php and apache2 cookbooks. My role which is ran on a node:

name "development"

# list of recipes to run
run_list(
    "recipe[apt]",
    "recipe[php::source]",
    "recipe[apache2]",
    "recipe[apache2::mod_php5]",
    "recipe[apache2::mod_rewrite]",
)

# attributes setup
override_attributes(
    "php" => {
        "version" => "5.4.27",
        "checksum" => "3080690bbb14d798a511e325a81a6f32"
    }
)

As you can see, I would like to install PHP 5.4.27 from source. If I run only the php::source, I indeed have PHP 5.4.27. However, when I run the apache2 cookbook as well, the apache2::mod_php5 installs another PHP 5.3 from repository (Ubuntu 12.04 has PHP 5.3 in its repo). I guess the package installs libapache2-mod-php5 which relies on php5 package therefore the PHP is installed again.

I don't want two versions of PHP. I would like to have only one; the PHP 5.4.27. Both for Apache and CLI. Can I somehow instruct apache cookbook to use the PHP 5.4.27?

Was it helpful?

Solution

Not if you use the apache2::mod_php5 recipe.

If you look into the recipe you can see that it installs the libapache2-mod-php5 package, which brings php5-common as a dependency.

If you want to avoid pulling in that, you'll have to write your own recipe for the php module, probably compiling the module from source.

OTHER TIPS

You also can do that by creating a cookbook by yourself which includes a special php installation file

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top