Understanding the directory structure of a default Drupal installation will help you debug your site and teach you several important best practices, such as where downloaded modules and themes should reside and how to have different Drupal profiles. A default Drupal installation has the structure shown in Figure 1-4.
Figure 1-4. The default folder structure of a Drupal installation
Details about each element in the folder structure follow:
The files folder doesn't ship with Drupal by default, but it is needed if you plan on using a custom logo, enabling user avatars, or uploading other media associated with your new site. This subdirectory requires read and write permissions by the web server that Drupal is running behind.
The includes folder contains libraries of common functions that Drupal uses.
The modules folder contains the core modules, with each module in its own folder. It is best not to touch anything in this folder (you add extra modules in the sites directory).
The profiles folder contains different installation profiles for a site. If there are other profiles besides the default profile in this subdirectory, Drupal will ask you which profile you want to install when first installing your Drupal site. The main purpose of an installation profile is to enable certain core and contributed modules automatically. An example would be an e-commerce profile that automatically sets up Drupal as an e-commerce platform.
The scripts folder contains scripts for checking syntax, cleaning up code, and handling special cases with cron. It is not used within the Drupal request life cycle; these are shell and Perl utility scripts.
The sites directory (see Figure 1-5) contains your modifications to Drupal in the form of settings, modules, and themes. When you add modules to Drupal from the contributed modules repository or by writing your own, they go into sites/all/modules. This keeps all your Drupal modifications within a single folder. Inside the sites directory will be a subdirectory named default that holds the default configuration file for your Drupal site— settings. php. The default directory is typically copied and renamed to the URL of your site, so your settings file would be at sites/www.example.com/settings.php.
The themes folder contains the template engines and default themes for Drupal.
Was this article helpful?