Creating the files Directory

Drupal needs a place to store uploaded files. These files range from user pictures, to files attached to postings, to images and music files. These are all typically stored in a folder in the root Drupal installation called files and a subdirectory therein called pictures. If these directories don't exist, Drupal will create them for you. If you are installing Drupal on Windows, all is fine, and you can skip this section.

If you are installing Drupal on a flavor of *nix (a UNIX or Linux system), you will want to take an extra moment now to create the directories manually. The reason for this is that the files directory is the one place where web site users will be able to interact directly with the file system on your server; this is where their uploaded files will be stored. You therefore want to pay special attention to the permissions of this directory. Letting Drupal create the directory for you may not result in the best configuration, and may not even be possible, depending on how your system is configured.

The first step to creating the files directory with the optimal permissions is to determine the username of the web server process. To find out what user the Apache web server is running as, look in the httpd.conf file, which is responsible for the Apache configuration. There you will find an entry like this (from Debian 3.1):

User www-data

The actual name of the user depends on the operating system and distribution. Other common names for the user include wwwrun, www, apache, and wwwuser.

■ Note Some Apache servers run using suPHP (http://www.suphp.org/), and others are run as a CGI module. In both of these cases, the name of the process running the web server will be different. If you are unsure, contact your hosting service.

Once you know the username of the web server, you can create the files directory:

$ mkdir files $ mkdir files/pictures

Change the permissions so that the user is the web server and the group is a user group to which any of the developers working on your site will belong. I'll call the web server www-data and the users' group developers:

$ chown -R www-data:developers files

Finally, make sure that these directories have the proper permissions: $chmod -R 755 files

Was this article helpful?

0 0

Post a comment