Skip to content

Instantly share code, notes, and snippets.

@s-belichenko
Last active September 29, 2018 19:32
Show Gist options
  • Save s-belichenko/eedb345c2cdccd729aaf1d9c2bc2b7a1 to your computer and use it in GitHub Desktop.
Save s-belichenko/eedb345c2cdccd729aaf1d9c2bc2b7a1 to your computer and use it in GitHub Desktop.
Preparing Vagrant box via bootstrap script (scotch/box 3.5.0, purpose: apache2 + php 7.0)
#!/bin/bash
#########################################################
#
# Bootstrap script v1.0.1 for Vagrant scotch/box 3.5.0 (Ubuntu 16.04.2 LTS)
# Purpose: PHP 7.0
#
#########################################################
echo "==================== Set up php vars ======================"
echo "==> post_max_size = 100M"
sudo replace "post_max_size = 8M" "post_max_size = 100M" -- /etc/php/7.0/apache2/php.ini >/dev/null 2>&1
echo "==> upload_max_filesize = 100M"
sudo replace "upload_max_filesize = 2M" "upload_max_filesize = 100M" -- /etc/php/7.0/apache2/php.ini >/dev/null 2>&1
echo "==> date.timezone = Europe/Moscow"
sudo replace ";date.timezone =" "date.timezone = Europe/Moscow" -- /etc/php/7.0/apache2/php.ini >/dev/null 2>&1
echo "========================== XDebug =========================="
echo "==> Downloading xdebug-2.6.0"
if ! [ -L xdebug-2.6.0.tgz ]; then
rm -rf xdebug-2.6.0.tgz
fi
wget http://xdebug.org/files/xdebug-2.6.0.tgz -nv >/dev/null 2>&1
echo "==> Preparing files"
if ! [ -L xdebug-2.6.0 ]; then
rm -rf xdebug-2.6.0
fi
tar -xvzf xdebug-2.6.0.tgz >/dev/null 2>&1
cd xdebug-2.6.0 >/dev/null 2>&1
echo "==> Compiling xdebug"
sudo phpize
sudo ./configure >/dev/null 2>&1
sudo make >/dev/null 2>&1
echo "==> Installing xdebug"
sudo cp modules/xdebug.so /usr/lib/php/20151012 >/dev/null 2>&1
echo "zend_extension = /usr/lib/php/20151012/xdebug.so" | sudo tee --append /etc/php/7.0/apache2/php.ini 2>&1 >/dev/null
echo "======================== End of work ======================="
echo "==> Restarting web server"
sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment