#!/bin/bash

# -----------------------------------------------------------------------------
#
# Setting up php
#
# -----------------------------------------------------------------------------

# Load the functions needed to our shell provider
source ${provision_path}/functions.sh

# Add PPA repository
add-apt-repository -y ppa:ondrej/php5-5.6

apt-get update -qq
install_packages python-software-properties

# Atualiza lista de pacotes
apt-get update -qq

# Install all php packages
install_packages php5 php5-mysql php5-xdebug php5-curl

# Install our PHP configuration file
copy_file ${provision_path}/files/php/php-cli.ini /etc/php5/cli/php.ini
copy_file ${provision_path}/files/php/php-apache.ini /etc/php5/apache2/php.ini

# Install Composer
COMPOSER_BIN="/usr/local/bin/composer"

if [ ! -f ${COMPOSER_BIN} ]; then
  echo "Installing Composer"

  # Installing composer
  curl -sS https://getcomposer.org/installer | php
  mv composer.phar ${COMPOSER_BIN}
fi
