本来なら開発は本番環境と同じ状態でやるのが一番良いのですが、ネットがない環境でも作業ができるようにローカルに開発環境をセットアップします。
まずWampをダウンロードしてDドライブにインストール。インストールする場所はご自由に。
www.wampserver.com
D:\wamp\wwwがlocalhost(以下、ローカル)になります。
次にCodeigniterをダウンロード。
www.codeigniter.com/downloads
ダウンロードしたファイルを解凍してローカル配下に設置。
同梱されているuser_guideは開発自体には必要ないので別の場所に保管します。
開発ディレクトリ:
D:\wamp\www\lsc
マニュアルディレクトリ:
D:\wamp\www\manual\ci
とりあえずは、これで環境設定とインストールできました。
■ 微調整
初期設定でCodeigniterはsystemとapplicationの2つのディレクトリに別れてます。
これを少しだけ以下のように変更しました。
変更の理由は後日記載します。
それに伴い、index.phpも多少変更。
<?php
/*
* Constants: Core Application Constants
* EXT - The file extension. Typically ".php"
* FCPATH - The full server path to THIS file
* SELF - The name of THIS file (typically "index.php")
* ROOT - ROOT direcotry
* SYSPATH - The full server path to the "system" folder
* APPPATH - The full server path to the "application" folder
* EXTPATH- The full server path to the "extension" folder
*/
define('EXT', '.php');
define('FCPATH', __FILE__);
$pathinfo = pathinfo(FCPATH);
define('SELF', $pathinfo['basename']);
define('ROOT',realpath($pathinfo['dirname'].'/').'/');
unset($pathinfo);
define('SYSPATH', ROOT.'system/');
define('EXTPATH', ROOT.'extension/');
define('APPPATH', ROOT.'application/');
$f=pathinfo(__FILE__, PATHINFO_BASENAME);
if (!is_dir(SYSPATH)) exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".$f);
if (!is_dir(APPPATH)) exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: ".$f);
if (!is_dir(EXTPATH)) exit("Your extension folder path does not appear to be set correctly. Please open the following file and correct this: ".$f);
define('ENVIRONMENT', 'development');
if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
case 'development':
error_reporting(E_ALL);
break;
case 'testing':
case 'production':
error_reporting(0);
break;
default:
exit('The application environment is not set correctly.');
}
}
require(SYSPATH.'core/Bootstrap'.EXT);よく見たらほとんど全部変えてた(笑)
わからない人は触らないほうがいいかもしれませんねー。
変更がちゃんと動いてるかhttp://localhost/lsc/にアクセスして確認。
大丈夫そう。
それじゃあ次回からガリガリ開発です!


0 件のコメント:
コメントを投稿