Posted by: rainmore | January 17, 2009

Cakephp On IIS

$cake_core_folder = ‘path_to\cake_1.2.0.7296-rc2′;

include everything download from cakephp. In the folder, there are some sub-folder: app, cake, doc, vendor ..

$cake_app_folder =’D:\projects\cake_app\test’; // It’s app folder path ‘D:\projects\cake_app’ + your website’s name ‘test’

In the folder, there are some sub-folder: config, controllers, locale, models,
plugins, tests, tmp, vendors, views …

! remeber to set ‘tmp’ folder to ‘rewirtable’

$cake_webroot_folder = ‘D:\webroot’;

In the folder there are just css folder, files folder, img folder, js folder, css.php, index.php, test.php

1. CONFIG CAKEPHP STRUCTURE — Modify $cake_webroot_folder’s index.php like:
if (!defined(‘ROOT’)) {
//define(‘ROOT’, dirname(dirname(dirname(__FILE__))));
define(‘ROOT’, ‘D:’.DS.’Projects’.DS.’_Cake_APP’); //  use DS to replace ‘/’ in $cake_core_folder and get rid of your website’s name
}

if (!defined(‘APP_DIR’)) {
//define(‘APP_DIR’, basename(dirname(dirname(__FILE__))));
define(‘APP_DIR’, ‘test’); // just use your website’s name as this name
}

if (!defined(‘CAKE_CORE_INCLUDE_PATH’)) {
//define(‘CAKE_CORE_INCLUDE_PATH’, ROOT);
define(‘CAKE_CORE_INCLUDE_PATH’, ‘C:’.DS.’wamp’.DS.’lib’.DS.’cake_1.2.0.7296-rc2′); // use DS to replace ‘/’ in $cake_core_folder
}

!Note: you could simply copy all the file to your web serve root, it works. Above is just an advance configration.
2. CONFIG APPLICATION    — Modify ‘$cake_app_folder’
1). Modify ‘core’ @ ‘config’ folder
a. change Line 153 -> Configure::write(‘Security.salt’, ‘eeeeDYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi’); // Just add some letter to the long string
b. remove ‘//’ @ line 59 Configure::write(‘App.baseUrl’, env(‘SCRIPT_NAME’)); // only for IIS
or add belows after line 59 to support multi server;

if (!define(‘SERVER_APACHE’,false)){
define (‘BASE_URL’, env(‘SCRIPT_NAME’) );
}else{
define (‘BASE_URL’, env(‘SCRIPT_NAME’) . ‘?url=’);
}

For the latest version. Above code does not work any more as cake use App.base_url instead of BASE_URL

2). Change ‘database.php.default’ @ ‘config’ folder to ‘database.php’ and modify
a. for single project just modify ‘$default’ config or you can add new config like ‘$sitename’

3). Copy ‘default.ctp’ layout to ‘APP/views/layouts/’ or create a new layout and put that in the folder ‘APP/views/layouts/’
4). Create or Modify ‘APP/views/pages/home.ctp’ for the default contant page
5). Create or Modify CSS Javascript at $cake_webroot_folder’s CSS folder and JS folder respectively

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.