【CakePHP1.2】DBがSQLite,で、mod_rewriteを使わない場合に必要な修正
CakePHP1.2において、mod_rewriteを使わない場合に必要な修正は、
2箇所あります。
1.core.php 57行目のコメント記号を外し、有効にする。
#Configure::write('App.baseUrl', env('SCRIPT_NAME'));
↓
Configure::write('App.baseUrl', env('SCRIPT_NAME'));
2.URLの指定を変更する。
http://example.com/controller/action/ ↓ http://example.com/index.php/controller/action/
…なのですが、僕はDBにSQLiteを使っているので、もうひとつ
変更しなきゃいけない箇所がありました。
それは、database.phpで指定するDBの設定の配列の中の
'database'キーの値についてです。
SQLiteのDBファイルを下記の場所に置いている場合、
\CakePHPインストールフォルダ \app \webroot \SQLite2 test.sqlite
database.phpでの設定は、下記のようになります。
class DATABASE_CONFIG { var $default = array( 'driver' => 'sqlite', 'connect' => 'sqlite_open', 'database' => './SQLite2/test.sqlite' ↓ 'database' => './app/webroot/SQLite2/test.sqlite' ); }
これがわからずに、苦労しました…。