Skip to content

Instantly share code, notes, and snippets.

@andonovn
Last active January 3, 2017 05:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andonovn/b4c51c9ad32ea1972620e75234ee34b8 to your computer and use it in GitHub Desktop.
Save andonovn/b4c51c9ad32ea1972620e75234ee34b8 to your computer and use it in GitHub Desktop.
Vagrant Phalcon Install Script with Apache2 & PHP-7.0
#!/usr/bin/env bash
echo "--- Updating packages list ---"
sudo apt-get update
echo "--- PHP & Apache ---"
sudo apt-get install -y vim curl php7.0 apache2 libapache2-mod-php7.0 php7.0-curl php7.0-gd php7.0-mcrypt php7.0-pgsql php7.0-mbstring git-core
echo "--- Setting document root ---"
sudo rm -rf /var/www
sudo ln -fs /vagrant/public /var/www
echo "--- PHP errors enabling ---"
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.0/apache2/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.0/apache2/php.ini
echo "--- Composer ---"
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
echo "--- Phalcon ---"
curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | sudo bash
sudo apt-get install php7.0-phalcon
echo "--- Apache configuration ---"
sudo sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
sudo sed -i 's/Require all denied/Require all granted/' /etc/apache2/apache2.conf
sudo a2enmod rewrite
echo "--- Virtual host ---"
sudo sed -i '$a 127.0.0.1 domain.dev' /etc/hosts
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/domain.dev.conf
sudo sed -i 's/#ServerName www.example.com/ServerName domain.dev/' /etc/apache2/sites-available/domain.dev.conf
sudo sed -i 's@DocumentRoot /var/www/html@DocumentRoot /vagrant/public@' /etc/apache2/sites-available/domain.dev.conf
sudo a2ensite domain.dev
sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment