I recently had to setup PHP 5.6 explicitly for testing and verifying work on a client website. Given Ubuntu 14.04LTS natively supports PHP 5.5.9, and the defacto standard ondrej/ppa is now installing PHP7 it took me a bit to understand exactly how to get 5.6 so we could verify tests and all that goodness. In retrospect, it’s obvious, but this may hopefully save someone out there the hour of raised eyebrows.

Via Ansible:

- name: add ondrej repo for latest php
  apt_repository:
    repo: 'ppa:ondrej/php'
    state: present
  become: true
  become_user: root

- apt: name="{{ item }}" state=latest update_cache=yes cache_valid_time=86400
  with_items:
  - python-software-properties

# I can't seem to make this work without the redundancy for python-software-properties above
# Combining the two and simply having it listed first (you'd think, right?) does not work here.
# Anyone know how to workaround that?
- apt: name="{{ item }}" state=latest update_cache=yes cache_valid_time=86400
  with_items:
  - libapache2-mod-php5.6
  - php5.6
  - php5.6-dev
  - php5.6-mysql
  - php5.6-xml
  - unzip

- name: restart apache
  service: name=apache2 state=restarted

 

Categories: Random

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *