2010年11月21日日曜日

CakePHPディレクト構成の変更

When the archive is extracted, it becomes a composition of the following directories.

  1. Method of arranging directory that needs manager authority.
  2. ├var

    ├www
    │ │ ├cake ← When the archive is extracted,
    │ │ │ ├app
    │ │ │ │ ├config
    │ │ │ │ ├controllers
    │ │ │ │ ├models
    │ │ │ │ ├plugins
    │ │ │ │ ├tmp
    │ │ │ │ ├vendors
    │ │ │ │ ├views
    │ │ │ │ ├webroot ← It is set to the document route.
    │ │ │ │ ├.htaccess
    │ │ │ │ └index.php
    │ │ │ ├cake
    │ │ │ ├vendors
    │ │ │ ├.htaccess
    │ │ │ └index.php

  3. Method of arranging directory that doesn't need manager authority.
  4. ├cake
    │ ├app ・・・(1)
    │ │ ├config
    │ │ ├controllers
    │ │ ├models
    │ │ ├plugins
    │ │ ├tmp
    │ │ ├vendors
    │ │ ├views
    │ │ ├webroot ・・・(3)
    │ │ ├.htaccess
    │ │ └index.php
    │ ├cake ・・・(2)
    │ ├vendors
    │ ├.htaccess
    │ └index.php

    It becomes the following if it arranges it according to the custom of the Linux system.


    ├ home
    │ └ user
    │   └ app ← Directory (1) is moved here.
    ├ usr
    │ └ lib
    │   └ cake ← Directory (2) is moved here.
    ├ var
    │ └ www
    │   └ *** ← Contents of the directory that name is (3) are moved here.


    The procedure summary.
    unzip ./cakephp-cakephp-1.3.5-0-ga16f4c5.zip
    $ mv ./cakephp-cakephp-fd82f1b/app /home/user/app
    $ mv ./cakephp-cakephp-fd82f1b/cake /usr/lib/cake
    $ mv ./cakephp-cakephp-fd82f1b/app/webroot/* /var/www
    $ mv ./cakephp-cakephp-fd82f1b/app/webroot/.htaccess /var/www
    $ chmod -R 0777 /home/user/app/tmp
    When the movement of the file is completed, three places of the following of the content of index.php are edited.

    • ROOT定数にappを含むディレクトリへのパスを設定する。

    • 今回の例では、"/home/user"
    • APP_DIR定数にappディレクトリの名前を設定する。

    • 今回の例では、"app"
    • CAKE_CORE_INCLUDE_PATH定数にcakeディレクトリを含むディレクトリへのパスを設定する。

    • 今回の例では、"/usr/lib"

    Concretely, it edits it as follows.

    if (!defined('ROOT')) {
       define('ROOT', DS . "home" . DS . "user");
    }
    if (!defined('APP_DIR')) {
       define('APP_DIR', "app");
    }
    if (!defined('CAKE_CORE_INCLUDE_PATH')) {
       define('CAKE_CORE_INCLUDE_PATH', DS . "usr" . DS . "lib");
    }

0 件のコメント:

コメントを投稿