Installation - Setting directory and file permissions

From Qubit Toolkit

Jump to: navigation, search

For Qubit or ICA-AtoM (or any PHP web application) to run properly requires the web server and PHP to have the necessary read and write permissions to the directories and files that make up the web application. Getting the directory and file permissions right can be frustrating to those that don't have experience with web application setup or Linux, so we've included some quick instructions to help you along.

[edit] Who is Apache?

Perhaps we should start with the question "What is Apache"? Apache is the most popular web server in the world today (and since 1996 according to their website). It's fast, free, open source and runs on a wide variety of operating systems and platforms. Apache is also our recommended web server for deploying Qubit and ICA-AtoM.

The first step to figuring out how to set your directory and file permissions, is figuring out what user your Apache process runs as. When setting permissions you'll need to assign an "owner" for each file and directory, and for Apache to do it's work, the file owner should be the Apache user.

To find out what user your Apache process (and by extension, your PHP process) is running as:

  1. Create a new file in the web root of you server called "test.php" or whatever you like, as long as it has ".php" at the end.
  2. Add the following line:
    <?php echo exec('whoami') ?>
    
  3. Save the file.
  4. If you don't know the URL to access the test.php file you just created, try something like the homepage of your website, plus "test.php", e.g. http://example.com/test.php
  5. You should see a blank white page with one word, that's the name of your Apache user!

Don't be surprised if your Apache user comes back with the name "nobody", this is a default Apache user for many versions of Linux, and is used to make it clear that Apache is not expected to have any permissions in the filesystem outside of the web root for security reasons.

[edit] Changing the directory and file owner

Now we need to change the "owner" for all the files and directories in the Qubit application - luckily there's a way to do this for everything at the same time, so we don't have to do it one directory or file at a time.

To set the "owner" to your Apache user (apache-user for this example) for all of the files and directories in your Qubit directory (e.g. qubit-dir) type:

chown -R apache-user qubit-dir

Now you are ready to run the web installer!

Personal tools