Skip to content

Instantly share code, notes, and snippets.

@anyt
Forked from iamdey/lamp-install-dev.sh
Last active August 29, 2015 14:11
Show Gist options
  • Save anyt/869edabe1d83d2613226 to your computer and use it in GitHub Desktop.
Save anyt/869edabe1d83d2613226 to your computer and use it in GitHub Desktop.
#!/bin/bash
sudo apt-get install apache2 php5 mysql-server libapache2-mod-php5 php5-mysql php5-sqlite php5-intl php5-cli php-apc php5-xdebug acl git
## configuration apache
sudo sed -i 's#/var/www#/vagrant#g' /etc/apache2/sites-available/default
sudo adduser www-data vagrant
## config php apache DEV
php_ini="/etc/php5/apache2/php.ini"
if [ ! -f $php_ini".bak" ]
then
sudo cp $php_ini $php_ini".bak"
fi
sudo sed -i 's/short_open_tag = On/short_open_tag = Off/g' $php_ini
sudo sed -i 's/memory_limit = \d{1-3}M/memory_limit = 128M/g' $php_ini
sudo sed -i 's/error_reporting = .*/error_reporting = E_ALL | E_STRICT/g' $php_ini
sudo sed -i 's/display_errors = Off/display_errors = On/g' $php_ini
sudo sed -i 's/html_errors = Off/html_errors = On/g' $php_ini
if ! grep -xq "\[xdebug\]" $php_ini
then
sudo tee -a $php_ini <<XDEBUG
[xdebug]
xdebug.remote_enable=On
xdebug.remote_connect_back=On
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=10.0.0.1
xdebug.remote_port=9000
XDEBUG
fi
if ! grep -xq "ServerName" /etc/apache2/httpd.conf
then
echo "ServerName precise32" | sudo tee -a $php_ini
fi
sudo service apache2 restart
## config php cli DEV
php_ini="/etc/php5/cli/php.ini"
if [ ! -f $php_ini".bak" ]
then
sudo cp $php_ini $php_ini".bak"
fi
sudo sed -i 's/short_open_tag = On/short_open_tag = Off/g' $php_ini
sudo sed -i 's/memory_limit = \d{1-3}M/memory_limit = -1/g' $php_ini
sudo sed -i 's/error_reporting = .*/error_reporting = E_ALL | E_STRICT/g' $php_ini
sudo sed -i 's/display_errors = Off/display_errors = On/g' $php_ini
sudo sed -i 's/html_errors = Off/html_errors = On/g' $php_ini
exit 0
#!/bin/bash
sudo apt-get install vagrant virtualbox nfs-kernel-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment