Skip to content

Instantly share code, notes, and snippets.

@s-belichenko
Last active September 30, 2018 21:57
Show Gist options
  • Save s-belichenko/2f3169c321a29e50175d6da2cda807a0 to your computer and use it in GitHub Desktop.
Save s-belichenko/2f3169c321a29e50175d6da2cda807a0 to your computer and use it in GitHub Desktop.
Preparing Vagrant box via bootstrap script (scotch/box 3.0.0, purpose: php 5.6)
#!/bin/bash
#########################################################
#
# Bootstrap script v0.0.4 for Vagrant scotch/box 3.0.0
# Purpose: PHP 5.6
#
#########################################################
echo "================ Switching php7.0 to php5.6 ================"
echo "== Disabling php7.0 apache module =="
sudo a2dismod php7.0 >/dev/null 2>&1
echo "== Enabling php5 apache module =="
sudo a2enmod php5 >/dev/null 2>&1
echo "==================== Set up php vars ======================"
echo "==> post_max_size = 100M"
sudo replace "post_max_size = 8M" "post_max_size = 100M" -- /etc/php5/apache2/php.ini >/dev/null 2>&1
echo "==> upload_max_filesize = 100M"
sudo replace "upload_max_filesize = 2M" "upload_max_filesize = 100M" -- /etc/php5/apache2/php.ini >/dev/null 2>&1
echo "==> date.timezone = Europe/Moscow"
sudo replace ";date.timezone =" "date.timezone = Europe/Moscow" -- /etc/php5/apache2/php.ini >/dev/null 2>&1
echo "========================== Xdebug =========================="
echo "== Downloading xdebug-2.5.4 =="
if ! [ -L xdebug-2.5.4.tgz ]; then
sudo rm -rf xdebug-2.5.4.tgz
fi
wget http://xdebug.org/files/xdebug-2.5.4.tgz -nv >/dev/null 2>&1
echo "== Preparing files =="
if ! [ -L xdebug-2.5.4 ]; then
sudo rm -rf xdebug-2.5.4
fi
tar -xvzf xdebug-2.5.4.tgz >/dev/null 2>&1
cd xdebug-2.5.4 >/dev/null 2>&1
echo "== Installing phpize =="
sudo apt-get install php5-dev -qq --force-yes
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/php5/20131226 >/dev/null 2>&1
echo "zend_extension = /usr/lib/php5/20131226/xdebug.so" | sudo tee -a /etc/php5/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