Skip to content

Commit

Permalink
Merge pull request #370 from jtallant/master
Browse files Browse the repository at this point in the history
Distinction between php timezone and server timezone
  • Loading branch information
fideloper committed Jul 30, 2014
2 parents 9c79fed + 2580c09 commit 182c3c8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
14 changes: 12 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ hostname = "vaprobash.dev"
server_ip = "192.168.22.10"
server_memory = "384" # MB
server_swap = "768" # Options: false | int (MB) - Guideline: Between one or two times the server_memory
server_timezone = "UTC"

# UTC for Universal Coordinated Time
# EST for Eastern Standard Time
# US/Central for American Central
# US/Eastern for American Eastern
server_timezone = "UTC"

# Database Configuration
mysql_root_password = "root" # We'll assume user "root"
Expand All @@ -29,6 +34,7 @@ mysql_enable_remote = "false" # remote access enabled when true
pgsql_root_password = "root" # We'll assume user "root"

# Languages and Packages
php_timezone = "UTC" # http://php.net/manual/en/timezones.php
ruby_version = "latest" # Choose what ruby version should be installed (will also be the default version)
ruby_gems = [ # List any Ruby Gems that you want to install
#"jekyll",
Expand Down Expand Up @@ -69,6 +75,10 @@ Vagrant.configure("2") do |config|
# Set server to Ubuntu 14.04
config.vm.box = "ubuntu/trusty64"

# Set the server timezone
config.vm.provision "shell",
inline: "echo setting timezone to #{server_timezone}; ln -sf /usr/share/zoneinfo/#{server_timezone} /etc/localtime"

# Create a hostname, don't forget to put it to the `hosts` file
# This will point to the server's default virtual host
# TO DO: Make this work with virtualhost along-side xip.io URL
Expand Down Expand Up @@ -141,7 +151,7 @@ Vagrant.configure("2") do |config|
config.vm.provision "shell", path: "#{github_url}/scripts/base.sh", args: [github_url, server_swap]

# Provision PHP
config.vm.provision "shell", path: "#{github_url}/scripts/php.sh", args: [server_timezone, hhvm]
config.vm.provision "shell", path: "#{github_url}/scripts/php.sh", args: [php_timezone, hhvm]

# Enable MSSQL for PHP
# config.vm.provision "shell", path: "#{github_url}/scripts/mssql.sh"
Expand Down
11 changes: 7 additions & 4 deletions scripts/php.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env bash

if [[ $2 == "true" ]]; then
PHP_TIMEZONE=$1
HHVM=$2

if [[ $HHVM == "true" ]]; then

echo ">>> Installing HHVM"

Expand Down Expand Up @@ -72,8 +75,8 @@ EOF
sudo sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/fpm/php.ini

# PHP Date Timezone
sudo sed -i "s/;date.timezone =.*/date.timezone = ${2/\//\\/}/" /etc/php5/fpm/php.ini
sudo sed -i "s/;date.timezone =.*/date.timezone = ${2/\//\\/}/" /etc/php5/cli/php.ini
sudo sed -i "s/;date.timezone =.*/date.timezone = ${PHP_TIMEZONE/\//\\/}/" /etc/php5/fpm/php.ini
sudo sed -i "s/;date.timezone =.*/date.timezone = ${PHP_TIMEZONE/\//\\/}/" /etc/php5/cli/php.ini

sudo service php5-fpm restart
fi
fi

0 comments on commit 182c3c8

Please sign in to comment.