# Jaws and Cherokee with FastCGI

## About Jaws packages

First you need to download the latest version of Jaws, there are 3 types of jaws packages:

- The core: Only has the core and basic stuff to start hacking your own gadgets, it only includes core gadgets!
- The blog system: Includes the core and some gadgets so you can start creating your own blog, it only includes one theme.
- The complete: Includes everything, all gadgets and all themes.

In this tutorial we will use the complete tarball.

## Downloading

Go to any directory and download the .tar.gz with the help of your browser or wget, we will do it via wget:

    $ cd
    $ mkdir downloads
    $ cd downloads
    $ #We now download the 0.6.1-complete tarball with wget
    $ wget http://forge.novell.com/modules/xfcontent/private.php/jaws/jaws-0.6.1/jaws-complete-0.6.1.tar.gz

## Unpacking

Now, we unpack the tarball

    $ tar zxf jaws-complete-0.6.1.tar.gz

## Creating your public web directory

Now, we need to have a public web directory we will use $HOME/public_html (~/public_html).

    $ mkdir ~/public_html

## Copying Jaws to your public directory

Now, we need to move the Jaws files (PHP files) to our public web directory (public_html).

    $ mv jaws/html/* ~/public_html/

## Setting permissions

Now, we need to know who is going to run Cherokee, we have two options:

    * Checkout with ps ($ps aux) who's running Cherokee, if user nobody runs Cherokee all pages will be served by nobody user.
    * Checkout your Cherokee config to see if other user should run Cherokee.

    $ cd ~/public_html
    $ #In most cases user and group will be the same
    $ chown user.group data/ -R
    $ chown user.group config/ -R
    $ chmod 775 data/ -R
    $ chmod 775 config/ -R

## Configuring Cherokee with fcgi

Here you have two options:

    * Open your Cherokee configuration file (/etc/cherokee/cherokee.conf)
    * Open your site configuration file (/etc/cherokee/sites-enabled/yoursite)

Now add the following data:

    Port 80
    DocumentRoot /home/user/public_html
    DirectoryIndex index.php

    Directory / {
        Handler file
    }

    Extension php {
      Handler fcgi {
        Server localhost:8000 {
           Env PHP_FCGI_MAX_REQUESTS "2000"
           Env PHP_FCGI_CHILDREN     "3"
           Interpreter "/usr/lib/cgi-bin/php -b 8000"
        }
      }
    }

For example, if your user is: foobar you should add:

    Port 80
    DocumentRoot /home/foobar/public_html
    DirectoryIndex index.php

    Directory / {
        Handler file
    }

    Extension php {
      Handler fcgi {
        Server localhost:8000 {
           Env PHP_FCGI_MAX_REQUESTS "2000"
           Env PHP_FCGI_CHILDREN     "3"
           Interpreter "/usr/lib/cgi-bin/php -b 8000"
        }
      }
    }

## Restart Cherokee

If Cherokee was running you need to restart it if not just start it.

## Installing Jaws

Now point your browser to:

    http://localhost/install.php

## Done!

Done, you are part of Cherokee-Jaws family, now go with your friends and promote both projects!