Skip to content

Commit

Permalink
Merge pull request #570 from Repox/feature/phpppa
Browse files Browse the repository at this point in the history
Fix for changed PHP PPA repository
  • Loading branch information
fideloper authored May 2, 2017
2 parents 4982cec + 98f8c03 commit 85bc149
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 37 deletions.
10 changes: 5 additions & 5 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ mongo_enable_remote = "false" # remote access enabled when true

# Languages and Packages
php_timezone = "UTC" # http://php.net/manual/en/timezones.php
php_version = "5.6" # Options: 5.5 | 5.6
php_version = "5.6" # Options: 5.5 | 5.6 | 7.0 | 7.1
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 @@ -219,7 +219,7 @@ Vagrant.configure("2") do |config|
# config.vm.provision "shell", path: "#{github_url}/scripts/apache.sh", args: [server_ip, public_folder, hostname, github_url]

# Provision Nginx Base
# config.vm.provision "shell", path: "#{github_url}/scripts/nginx.sh", args: [server_ip, public_folder, hostname, github_url]
# config.vm.provision "shell", path: "#{github_url}/scripts/nginx.sh", args: [server_ip, public_folder, hostname, github_url, php_version]


####
Expand All @@ -239,7 +239,7 @@ Vagrant.configure("2") do |config|
# config.vm.provision "shell", path: "#{github_url}/scripts/rethinkdb.sh", args: pgsql_root_password

# Provision Couchbase
# config.vm.provision "shell", path: "#{github_url}/scripts/couchbase.sh"
# config.vm.provision "shell", path: "#{github_url}/scripts/couchbase.sh", args: [php_version]

# Provision CouchDB
# config.vm.provision "shell", path: "#{github_url}/scripts/couchdb.sh"
Expand Down Expand Up @@ -305,7 +305,7 @@ Vagrant.configure("2") do |config|
# config.vm.provision "shell", path: "#{github_url}/scripts/kibana.sh"

# Install ØMQ
# config.vm.provision "shell", path: "#{github_url}/scripts/zeromq.sh"
# config.vm.provision "shell", path: "#{github_url}/scripts/zeromq.sh", args: [php_version]

# Install RabbitMQ
# config.vm.provision "shell", path: "#{github_url}/scripts/rabbitmq.sh", args: [rabbitmq_user, rabbitmq_password]
Expand Down Expand Up @@ -341,7 +341,7 @@ Vagrant.configure("2") do |config|
# config.vm.provision "shell", path: "#{github_url}/scripts/screen.sh"

# Install Mailcatcher
# config.vm.provision "shell", path: "#{github_url}/scripts/mailcatcher.sh"
# config.vm.provision "shell", path: "#{github_url}/scripts/mailcatcher.sh", args: [php_version]

# Install git-ftp
# config.vm.provision "shell", path: "#{github_url}/scripts/git-ftp.sh", privileged: false
Expand Down
8 changes: 5 additions & 3 deletions scripts/mailcatcher.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

PHP_VERSION=$1

echo ">>> Installing Mailcatcher"

# Test if PHP is installed
Expand Down Expand Up @@ -43,9 +45,9 @@ sudo service mailcatcher start

if [[ $PHP_IS_INSTALLED -eq 0 ]]; then
# Make php use it to send mail
echo "sendmail_path = /usr/bin/env $(which catchmail)" | sudo tee /etc/php5/mods-available/mailcatcher.ini
sudo php5enmod mailcatcher
sudo service php5-fpm restart
echo "sendmail_path = /usr/bin/env $(which catchmail)" | sudo tee /etc/php/${PHP_VERSION}/mods-available/mailcatcher.ini
sudo phpenmod mailcatcher
sudo service php${PHP_VERSION}-fpm restart
fi

if [[ $APACHE_IS_INSTALLED -eq 0 ]]; then
Expand Down
6 changes: 4 additions & 2 deletions scripts/nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ else
github_url="$4"
fi

PHP_VERSION=$5

# Add repo for latest stable nginx
sudo add-apt-repository -y ppa:nginx/stable

Expand Down Expand Up @@ -70,9 +72,9 @@ sudo ngxdis default

if [[ $HHVM_IS_INSTALLED -ne 0 && $PHP_IS_INSTALLED -eq 0 ]]; then
# PHP-FPM Config for Nginx
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php5/fpm/php.ini
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/${PHP_VERSION}/fpm/php.ini

sudo service php5-fpm restart
sudo service php${PHP_VERSION}-fpm restart
fi

sudo service nginx restart
41 changes: 17 additions & 24 deletions scripts/php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,35 @@ if [[ $HHVM == "true" ]]; then
else
echo ">>> Installing PHP $PHP_VERSION"

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C

if [ $PHP_VERSION == "5.5" ]; then
# Add repo for PHP 5.5
sudo add-apt-repository -y ppa:ondrej/php5
else
# Add repo for PHP 5.6
sudo add-apt-repository -y ppa:ondrej/php5-5.6
fi
sudo add-apt-repository -y ppa:ondrej/php

sudo apt-key update
sudo apt-get update

# Install PHP
# -qq implies -y --force-yes
sudo apt-get install -qq php5-cli php5-fpm php5-mysql php5-pgsql php5-sqlite php5-curl php5-gd php5-gmp php5-mcrypt php5-memcached php5-imagick php5-intl php5-xdebug

sudo apt-get install -qq php${PHP_VERSION}-cli php${PHP_VERSION}-fpm php${PHP_VERSION}-mysql php${PHP_VERSION}-pgsql php${PHP_VERSION}-sqlite php${PHP_VERSION}-curl php${PHP_VERSION}-gd php${PHP_VERSION}-gmp php${PHP_VERSION}-mcrypt php${PHP_VERSION}-memcached php${PHP_VERSION}-imagick php${PHP_VERSION}-intl php${PHP_VERSION}-mbstring php${PHP_VERSION}-xml php-xdebug

# Set PHP FPM to listen on TCP instead of Socket
sudo sed -i "s/listen =.*/listen = 127.0.0.1:9000/" /etc/php5/fpm/pool.d/www.conf
sudo sed -i "s/listen =.*/listen = 127.0.0.1:9000/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf

# Set PHP FPM allowed clients IP address
sudo sed -i "s/;listen.allowed_clients/listen.allowed_clients/" /etc/php5/fpm/pool.d/www.conf
sudo sed -i "s/;listen.allowed_clients/listen.allowed_clients/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf

# Set run-as user for PHP5-FPM processes to user/group "vagrant"
# to avoid permission errors from apps writing to files
sudo sed -i "s/user = www-data/user = vagrant/" /etc/php5/fpm/pool.d/www.conf
sudo sed -i "s/group = www-data/group = vagrant/" /etc/php5/fpm/pool.d/www.conf
sudo sed -i "s/user = www-data/user = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf
sudo sed -i "s/group = www-data/group = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf

sudo sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php5/fpm/pool.d/www.conf
sudo sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php5/fpm/pool.d/www.conf
sudo sed -i "s/listen\.mode.*/listen.mode = 0666/" /etc/php5/fpm/pool.d/www.conf
sudo sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf
sudo sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf
sudo sed -i "s/listen\.mode.*/listen.mode = 0666/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf


# xdebug Config
cat > $(find /etc/php5 -name xdebug.ini) << EOF
zend_extension=$(find /usr/lib/php5 -name xdebug.so)
cat > /etc/php/${PHP_VERSION}/mods-available/xdebug.ini << EOF
zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_connect_back = 1
xdebug.remote_port = 9000
Expand All @@ -81,12 +74,12 @@ xdebug.var_display_max_data = 1024
EOF

# PHP Error Reporting Config
sudo sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/fpm/php.ini
sudo sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/fpm/php.ini
sudo sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/${PHP_VERSION}/fpm/php.ini
sudo sed -i "s/display_errors = .*/display_errors = On/" /etc/php/${PHP_VERSION}/fpm/php.ini

# PHP Date Timezone
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 sed -i "s/;date.timezone =.*/date.timezone = ${PHP_TIMEZONE/\//\\/}/" /etc/php/${PHP_VERSION}/fpm/php.ini
sudo sed -i "s/;date.timezone =.*/date.timezone = ${PHP_TIMEZONE/\//\\/}/" /etc/php/${PHP_VERSION}/cli/php.ini

sudo service php5-fpm restart
sudo service php${PHP_VERSION}-fpm restart
fi
8 changes: 5 additions & 3 deletions scripts/zeromq.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

PHP_VERSION=$1

# Test if PHP is installed
php -v > /dev/null 2>&1
PHP_IS_INSTALLED=$?
Expand All @@ -14,7 +16,7 @@ sudo apt-get install -qq libtool autoconf automake uuid uuid-dev uuid-runtime bu

echo "" | sudo pecl install zmq-beta > /dev/null

sudo echo "extension=zmq.so" >> /etc/php5/mods-available/zmq.ini
sudo php5enmod zmq > /dev/null
sudo service php5-fpm restart > /dev/null
sudo echo "extension=zmq.so" >> /etc/php/${PHP_VERSION}/mods-available/zmq.ini
sudo phpenmod zmq > /dev/null
sudo service php${PHP_VERSION}-fpm restart > /dev/null

0 comments on commit 85bc149

Please sign in to comment.