Sunday, March 2, 2008

cakePHP : Installing CakePHP

Chapter 3. Installing CakePHP

Table of Contents

Introduction
Requirements
Server Requirements
Installing CakePHP
Getting the most recent stable version
Unpacking
Setting Up CakePHP
Development Setup
Production Setup
Advanced Setup: Alternative Installation Options
Configuring Apache and mod_rewrite
Make Sure It's Working

Introduction

So now you know everything there is to know about the structure and purpose of all the CakePHP libraries, or you have skipped to this part because you don't care about that stuff and just want to start playing. Either way, you're ready to get your hands dirty.

This chapter will describe what must be installed on the server, different ways to configure your server, downloading and installing CakePHP, bringing up the default CakePHP page, and some troubleshooting tips just in case everything does not go as planned.

Requirements

In order use CakePHP you must first have a server that has all the required libraries and programs to run CakePHP:

Server Requirements
Here are the requirements for setting up a server to run CakePHP:

An HTTP server (like Apache) with the following enabled: sessions, mod_rewrite (not absolutely necessary but preferred)

PHP 4.3.2 or greater. Yes, CakePHP works great in either PHP 4 or 5.

A database engine (right now, there is support for MySQL, PostgreSQL and a wrapper for ADODB).

Installing CakePHP

Getting the most recent stable version

There are a few ways you can secure a copy of CakePHP: getting a stable release from CakeForge, grabbing a nightly build, or getting a fresh version of code from SVN.

To download a stable version of code, check out the files section of the CakePHP project at CakeForge by going to http://cakeforge.org/projects/cakephp/.

To grab a nightly, download one from http://cakephp.org/downloads/index/nightly. These nightly releases are stable, and often include the bug fixes between stable releases.

To grab a fresh copy from our SVN repository, use your favorite SVN client and connect to https://svn.cakephp.org/repo/trunk/cake/ and choose the version you're after.

Unpacking

Now that you've downloaded the most recent release, place that compressed package on your web server in the webroot. Now you need to unpack the CakePHP package. There are two ways to do this, using a development setup, which allows you to easily view many CakePHP applications under a single domain, or using the production setup, which allows for a single CakePHP application on the domain.

Configuring Apache and mod_rewrite


While CakePHP is built to work with mod_rewrite out of the box, we've noticed that a few users struggle with getting everything to play nicely on their systems. Here are a few things you might try to get it running correctly:

Make sure that an .htaccess override is allowed: in your httpd.conf, you should have a section that defines a section for each Directory on your server. Make sure the AllowOverride is set to All for the correct Directory.

Make sure you are editing the system httpd.conf rather than a user- or site-specific httpd.conf.

For some reason or another, you might have obtained a copy of CakePHP without the needed .htaccess files. This sometimes happens because some operating systems treat files that start with '.' as hidden, and don't copy them. Make sure your copy of CakePHP is from the downloads section of the site or our SVN repository.

Make sure you are loading up mod_rewrite correctly! You should see something like LoadModule rewrite_module libexec/httpd/mod_rewrite.so and AddModule mod_rewrite.c in your httpd.conf.

If you are installing Cake into a user directory (http://example.com/~myusername/), you'll need to modify the .htaccess file in the base directory of your Cake installation. Just add the line "RewriteBase /~myusername/".

If for some reason your URLS are suffixed with a long, annoying session ID (http://example.com/posts/?CAKEPHP=4kgj577sgabvnmhjgkdiuy1956if6ska), you might also add "php_flag session.trans_id off" to the .htaccess file at the root of your installation as well.

Make Sure It's Working

Alright, lets see this baby in action. Depending on which setup you used, you should point your browser to http://www.example.com or http://www.example.com/cake. At this point, you'll be presented with CakePHP's default home, and a message that tells you the status of your current database connection.

Congratulations! You are ready to create your first Cake-based application.

1 comment:

Anonymous said...

Millions of eager Twilight fans are impatiently awaiting the release of the New Moon THIRD WATCH . Twi-hard fans flocked to movie theaters by the thousands when New Moon hit the theaters. New Moon THIRD WATCH DVD COLLECTION is a sequel to the popular movie Twilight, which was also a big box office smash and it is anticipated that the New Moon THIRD WATCH DVD will sell extremely well when it is released.


Wisdom is available to be the Ed Hardy clothing Swim Trunks clothing. Whether you want a costume or sewn into the shirt as we know it. It is definitely one talented hardy shirt that seems to be winning over the world. hardy shirts does not open to have to covering out a bunch of money in overcharging the people that obtain his Ed resilient clothes and that is hardy shirts .


The Hogan are for you. Sure, you can't twist Hogan scarpe donna into uniform planes of color. And you can't model Hogan scarpe uomo as a pair of hyperbolic purebloods for the feet. But you can wear them and look cool, maybe for the first time in your life. Go for Hogan uomo . You know you want to.