Last active
April 27, 2016 10:16
-
-
Save igodorogea/7f5ee98435efb8def2d93eec135c21b1 to your computer and use it in GitHub Desktop.
Debian Jessie php development environment
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 | |
function say { | |
printf "\n--------------------------------------------------------\n" | |
printf "\t$1" | |
printf "\n--------------------------------------------------------\n" | |
} | |
say "Prepare machine..." | |
# Upgrading | |
sudo apt-get -qq update | |
sudo apt-get -qq dist-upgrade | |
sudo apt-get autoremove -y | |
sudo apt-get autoclean -y | |
# Git | |
say "Installing Git" | |
sudo apt-get install git -y | |
git config --global color.branch auto | |
git config --global color.diff auto | |
git config --global color.status auto | |
say "Installing MySQL" | |
sudo apt-get install debconf-utils -y | |
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password 1234" | |
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password 1234" | |
sudo apt-get install -y mysql-server | |
sudo service mysql restart | |
say "Installing PHP" | |
sudo apt-get install -y curl imagemagick graphicsmagick memcached php5 php5-cli php5-curl php-pear php5-xdebug php5-gd php5-mcrypt php5-xsl php5-intl php5-memcache php5-apcu php5-mysql | |
say "Install apache2" | |
sudo apt-get purge -y apache* | |
sudo apt-get install -y libapache2-mod-php5 apache2-mpm-itk | |
sudo a2enmod rewrite | |
if [ ! -d ~/Work/configs/vhosts ]; then | |
mkdir -p ~/Work/configs/vhosts | |
fi | |
if ! grep -q "IncludeOptional ~/Work/configs/vhosts/\*\.conf" "/etc/apache2/apache2.conf"; then | |
sudo bash -c 'echo "IncludeOptional ~/Work/configs/vhosts/*.conf" >> /etc/apache2/apache2.conf' | |
fi | |
say "Adjust php.ini" | |
sudo sed -i 's/max_execution_time = 30/max_execution_time = 300/' /etc/php5/apache2/php.ini | |
sudo sed -i 's/max_input_time = 60/max_input_time = 150/' /etc/php5/apache2/php.ini | |
sudo sed -i 's/memory_limit = 128M/memory_limit = 384M/' /etc/php5/apache2/php.ini | |
sudo sed -i 's/display_startup_errors = Off/display_startup_errors = On/' /etc/php5/apache2/php.ini | |
sudo sed -i 's/track_errors = Off/track_errors = On/' /etc/php5/apache2/php.ini | |
sudo sed -i 's/post_max_size = 8M/post_max_size = 20M/' /etc/php5/apache2/php.ini | |
sudo sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 20M/' /etc/php5/apache2/php.ini | |
sudo sed -i 's@;date.timezone =@date.timezone = "Europe/Berlin"@' /etc/php5/apache2/php.ini | |
sudo sed -i 's/;always_populate_raw_post_data/always_populate_raw_post_data/' /etc/php5/apache2/php.ini | |
sudo sed -i 's/display_errors = Off/display_errors = On/' /etc/php5/apache2/php.ini | |
sudo sed -i 's/error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT/error_reporting = E_ALL/' /etc/php5/apache2/php.ini | |
say "Config xdebug.ini" | |
if ! grep -q "xdebug.max_nesting_level=400" "/etc/php5/apache2/conf.d/20-xdebug.ini"; then | |
sudo bash -c "echo 'xdebug.max_nesting_level=400' >> /etc/php5/apache2/conf.d/20-xdebug.ini" | |
fi | |
if [ ! -f ~/Work/configs/vhosts/localhost.conf ]; then | |
touch ~/Work/configs/vhosts/localhost.conf | |
echo 'ServerName localhost' > ~/Work/configs/vhosts/localhost.conf | |
fi | |
sudo service apache2 restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment