Skip to content

Instantly share code, notes, and snippets.

@chrisshennan
Last active October 1, 2015 19:41
Show Gist options
  • Save chrisshennan/ad960332977496a419c0 to your computer and use it in GitHub Desktop.
Save chrisshennan/ad960332977496a419c0 to your computer and use it in GitHub Desktop.
Installing & Configuring Symfony2
# Test the database connection using a simple query (no database tables required)
cd /data/projects/insidethe.agency
php app/console doctrine:query:sql "SELECT NOW()";
# Create the projects folder
mkdir -parents /data/projects
cd /data/projects/
# Create a new symfony2 project
symfony new insidethe.agency
# Download the Symfony2 installer
sudo curl -LsS http://symfony.com/installer -o /usr/local/bin/symfony
sudo chmod a+x /usr/local/bin/symfony
# Download composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
# Launch the Symfony2 built-in webserver on the default port (8000)
cd /data/projects/insidethe.agency
php app/console server:run
# Go to the root of the project
cd /data/projects/insidethe.agency
# Remove any cache & log files that currently exists
rm -rf app/cache/*
rm -rf app/logs/*
# Set the correct permission on the cache and log directories
HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
sudo chmod +a "$HTTPDUSER allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
# Create the demo application
cd /data/projects
symfony demo demo
# Run the built-in webserver
cd /data/projects/demo
php app/console server:run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment