Setting Drupal File Paths in settings.php

Working in Drupal, we often pull databases from different environments for debugging and general development. Every time we did that, we had to update the files locations in /admin/config/media/file-system. It only takes a few seconds to update, but it’s a pain.

Well, no more.

We now put those variables in our settings.php file, and they’re updated automatically.

 $conf['file_public_path'] = 'sites/petessite/files';
 $conf['file_private_path'] = 'sites/petessite/files/private';
 $conf['file_temporary_path'] = 'sites/petessite/files/tmp';


(Yes, I know that file_private_path should be outside the web accessible structure.. but this is for Development, remember?)


About Peter Connolly

Pete Connolly is Technical Director at KP Direction LLC. An experienced IT Manager and PHP developer, Peter is currently develops leading-edge Drupal solutions for companies that you'll have heard of, if only we could tell you who they are. More..