• RESUME
  • LOGIN

balanced scale media

  • blog
  • projects
  • services
  • contact
Home › Blogs › boz's blog

Practical Usage of Symbolic Links

boz — Sat, 04/18/2009 - 14:12

Symbolic links work kind of like shortcuts in Windows.  I have found a couple of very useful scenarios.  The first is my local development environment.  For Linux users, it is best practice to keep all your files in your user folder.  For me, this is mainly to keep my system directories clean and to make backup of my files easier.  This leads me to my first usage:

1. Managing Development Files for Apache

Apache is looking for my files in the /var/www directory.  I want to keep my development files in my user directory.  To solve this I create a link to my development folders and store them in /var/www.  For example, if I wanted to run drupal local, which I do.  I create a link to drupal in /var/www like so:

ln -s /home/boz/public_html/drupal /var/www/drupal

ln is the command, "-s" means symbolic link, as opposed to a hard link, followed by the source directory and the new link.  Now I can access my drupal site in apache while maintaining my development files from my user directory.

2. Managing Multisite Configuration in Drupal

Drupal allows you to run as many domains as you like while sharing the same core Drupal files.  Included in my development cycle is the creation of a test site for my clients to look over my work and make sure everything good to go before we publish the site.  If I haven't transfered the domain for their site to my host then I usually just use a subdomain of this site for the testing i.e. somesite.balancedscale.com.  Drupal's multisite configuration is based on directories named after the domains they correspond to.  I don't want to maintain two different Drupal directories for the same project and so I create a symbolic link on my host servers between the test site domain directory and the target domain directory.  Here's is an example that I used on my most recent project for the website loftusheatingandac.com.

ln -s /drupal/sites/loftusheatingandac.com /drupal/sites/loftuslennox.balancedscale.com

Now when the domain is transfered I can just point it to the drupal folder and all is good.  The test site and the production site use the same files and the same database.

How do use Symbolic Links?

  • Drupal
  • Linux
  • boz's blog
  • Add new comment

Recent Posts

  • Generate Word Documents With PHP
  • Delete CCK Inactive Fields
  • Delete Nodes From A Certain Date in Drupal
  • Automated Node Titles Without Auto Node Title
  • Drupal Camp Iowa Ajax Example
  • Get Paid To Learn Drupal!
  • Presenting "JavaScript Guidelines : When and When Not to Script"
  • Drupal Form Alter on a Node Reference Widget
  • The Paradox Of Drupal
  • Programmatically Creating Users in Drupal with Profile Fields
more

Topics

  • Android
  • Apace
  • Aptana
  • Bazaar
  • Browser
  • Code
  • Drupal
  • Eclipse
  • Flex
  • HTML 5

Archive

  • February 2008 (1)
  • May 2008 (1)
  • July 2008 (3)
  • December 2008 (2)
  • January 2009 (2)
  • March 2009 (3)
  • April 2009 (5)
  • May 2009 (1)
  • July 2009 (1)
  • August 2009 (3)
more

Links

 

  • blog
  • projects
  • services
  • contact

© 2012 Balanced Scale Media, LLC. All Rights Reserved.