I've been using Opsworks recently and am really impressed by the GIT integration to deploy apps across my server estate. But I have a requirement due to an external library to use PHP 5.4 > The Amazon Linux offering has PHP5.3 installed. Now I created a separate ec2 instance based off Amazon Linux and upgraded the PHP version,I actually used custom user data to accomplish this. I then saved this as a custom AMI. When I set this as the AMI to use in opsworks for an instance, there are errors starting the server that arise from conflicting versions of Apache etc. So it looks like my AMI was almost ignored, or that it built my AMI and used the custom data, and then tries to run the CHEF recipes. Then I believe it might actually be the Chef recipes failing to install what they need to hence the error.
I've tried doing the same thing with the Ubuntu AMI which uses PHP 5.5 by default but i've got separate issues with trying to enable mod_rewrite for my app directory on here. Though I am trying to work through this as well as a solution to my problem with the Amazon Linux AMI
So my question is, do the Chef recipes run after my user_data? Or would I in theory be able to uninstall every thing that Chef would install in my custom user_data and then my actual dependencies would be installed after? I'm not familiar enough with Chef at the moment to try and edit the default PHP-APP-Server recipe to do what I need ( I'm also not sure exactly what I need from the AWS GitHub repo to do this)
Or does anyone have any better ideas?
As per my understanding, you need to modify your chef recipe (i.e. learn a bit of chef) to change PHP version installed. Else you would keep on running into issues and even if you install a different PHP version, chef would automatically try to revert it as this is what it is supposed to do.
I believe PHP 5.5 is now available in the AL repos as php55.
You can override the PHP packages via your chef recipes here: https://github.com/aws/opsworks-cookbooks/blob/release-chef-11.4/mod_php5_apache2/attributes/default.rb#L19
You can override that either with custom JSON, or using the attributes file: http://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook-installingcustom-components-attributes.html
You will most likely need to add a custom recipe to remove the old version of php first though, for example here: Update PHP with yum on Amazon Linux