Last active
September 29, 2018 19:33
-
-
Save s-belichenko/433d584ee9ec3b954b65aef29cdafc36 to your computer and use it in GitHub Desktop.
Preparing Vagrant box via bootstrap script (scotch/box 3.5.0, purpose: apache2 + php 7.1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
######################################################### | |
# | |
# Bootstrap script v1.0.0 for Vagrant scotch/box 3.5.0 (Ubuntu 16.04.2 LTS) | |
# Purpose: PHP 7.1 | |
# | |
######################################################### | |
echo "================== Installing PHP 7.1 =====================" | |
echo "==> Adding ondrej/php to repositories" | |
sudo add-apt-repository ppa:ondrej/php -y >/dev/null 2>&1 | |
sudo apt-get update >/dev/null 2>&1 | |
echo "==> Installing packages" | |
sudo apt-get install -y --allow-unauthenticated apache2 git curl php7.1 php7.1-bcmath php7.1-bz2 php7.1-cli php7.1-curl php7.1-intl php7.1-json php7.1-mbstring php7.1-opcache php7.1-soap php7.1-sqlite3 php7.1-xml php7.1-xsl php7.1-zip libapache2-mod-php7.1 php7.1-mysql >/dev/null 2>&1 | |
echo "==> Enabling/disabling apache2 modules" | |
sudo a2dismod php7.0 >/dev/null 2>&1 | |
sudo a2enmod php7.1 >/dev/null 2>&1 | |
echo "==> Restarting web server" | |
sudo service apache2 restart >/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/php/7.1/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.1/apache2/php.ini >/dev/null 2>&1 | |
echo "==> date.timezone = Europe/Moscow" | |
sudo replace ";date.timezone =" "date.timezone = Europe/Moscow" -- /etc/php/7.1/apache2/php.ini >/dev/null 2>&1 | |
echo "========================== XDebug ==========================" | |
echo "==> Downloading xdebug-2.6.1" | |
if ! [ -L xdebug-2.6.1.tgz ]; then | |
rm -rf xdebug-2.6.1.tgz | |
fi | |
wget http://xdebug.org/files/xdebug-2.6.1.tgz -nv >/dev/null 2>&1 | |
echo "==> Preparing files" | |
if ! [ -L xdebug-2.6.1 ]; then | |
rm -rf xdebug-2.6.1 | |
fi | |
tar -xvzf xdebug-2.6.1.tgz >/dev/null 2>&1 | |
cd xdebug-2.6.1 >/dev/null 2>&1 | |
echo "==> Installing phpize" | |
sudo apt-get install php7.1-dev -qq >/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/20160303 >/dev/null 2>&1 | |
echo "zend_extension = /usr/lib/php/20160303/xdebug.so" | sudo tee --append /etc/php/7.1/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