FOLLOWS ON FROM “CHEF install MySQL on AWS EC2 Ubuntu

 

The php cookbook depends on the xml, yum-epel, windows, and iis cookbooks, so we’ll need those even though we won’t be using all of them. We’ll also have to install sub-dependencies yum (a dependency of yum-epel), chef_handler, and powershell (dependencies of windows).

 

cd /root/chef-repo/cookbooks

knife cookbook site download php

tar zxf php*.tar.gz

knife cookbook site download xml

tar zxf xml-*.tar.gz

knife cookbook site download yum

tar zxf yum-*.tar.gz

knife cookbook site download yum-epel

tar zxf yum-epel-*.tar.gz

knife cookbook site download powershell

tar zxf powershell-*.tar.gz

knife cookbook site download iis

tar zxf iis-*.tar.gz

rm *.tar.gz

 

Here we add the PHP default recipe, one to install the PHP MySQL extension and one to enable the Apache PHP module mod_php. We also enable the default site so we can check our installation has worked.

 

cd phpapp

vi metadata.rb # add the following line

depends “php”

vi recipes/default.rb # change the include_recipe lines to the following

include_recipe “apache2”

include_recipe “mysql::client”

include_recipe “mysql::server”

include_recipe “php”

include_recipe “php::module_mysql”

include_recipe “apache2::mod_php5”

cd ../..
chef-solo -c solo.rb -j web.json

N.B. I had to edit php/metadata.json and change the text “mysql”:”>= 6.0.0″ to “mysql”:”>= 0.0.0″

TEST
Open /var/www/test.php in your editor and insert the line
< ? php
phpinfo();
? >
NOW

vi /etc/apache2/apache2.conf  # and change the section to the following:

Options FollowSymLinks
AllowOverride None
Require all granted

Now goto http://yourserver/test.php

Next page CHEF configure MySQL on AWS EC2 Ubuntu