2.5. Preparing the Scripts Directory
Now you have to select a directory where all the mod_perl scripts and modules will be placed. We usually create a directory called modperl under our home directory for this purpose (e.g., /home/stas/modperl), but it is also common to create a directory called perl under your Apache server root, such as /usr/local/apache/perl.
panic% mkdir /home/stas/modperl
Next, set the file permissions. Remember that when scripts are executed from a shell, they are being executed with the permissions of the user's account. Usually, you want to have read, write, and execute access for yourself, but only read and execute permissions for the server. When the scripts are run by Apache, however, the server needs to be able to read and execute them. Apache runs under an account specified by the User directive, typically nobody. You can modify the User directive to run the server under your username, for example:
Since the permissions on all files and directories should usually be rwx------, set the directory permissions to:
panic% chmod 0700 /home/stas/modperl
Now no one but you and the server can access the files in this directory. You should set the same permissions for all the files you place under this directory. 
If the server is running under the nobody account, you have to set the permissions to rwxr-xr-x or 0755 for your files and directories. This is insecure, because other users on the same machine can read your files.
panic# chmod 0755 /home/stas/modperl
If you aren't running the server with your username, you have to set these permissions for all the files created under this directory so Apache can read and execute them.
In the following examples, we assume that you run the server under your username, and hence we set the scripts' permissions to 0700.
Copyright © 2003 O'Reilly & Associates. All rights reserved.