Motomichi Works Blog

モトミチワークスブログです。その日学習したことについて書いている日記みたいなものです。

さくらのVPSを使う その0006-01 cakephpをインストールする(エラーが出ているのでtmpのパーミッションを変更する)

参考にさせて頂いたページ

CakePHP 2.x - CakePHP インストール時エラーの対処

cakephpをダウンロードして、サーバにアップロードする。

現在の最新の、cakephp-2.7.1.zipをダウンロードして解凍した。

cake271というディレクトリ名にして、サーバにアップロードした。

/var/www/html/cake271/

今のところ上記のようなディレクトリ構造になっています。

ページを見てみたらエラーが出た

この状態で

http://xxxxxx.vs.sakura.ne.jp/cake271/

にアクセスしたら、

Warning: _cake_core_ cache was unable to write 'cake_dev_ja' to File cache in /var/www/html/cake271/lib/Cake/Cache/Cache.php on line 328 Warning: /var/www/html/cake271/app/tmp/cache/persistent/ is not writable in /var/www/html/cake271/lib/Cake/Cache/Engine/FileEngine.php on line 385 

Fatal error: Uncaught exception 'CacheException' with message 'Cache engine "_cake_core_" is not properly configured. Ensure required extensions are installed, and credentials/permissions are correct' in /var/www/html/cake271/lib/Cake/Cache/Cache.php:186 

Stack trace: #0 /var/www/html/cake271/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('_cake_core_') 
#1 /var/www/html/cake271/app/Config/core.php(374): Cache::config('_cake_core_', Array) 
#2 /var/www/html/cake271/lib/Cake/Core/Configure.php(72): include('/var/www/html/c...') 
#3 /var/www/html/cake271/lib/Cake/bootstrap.php(175): Configure::bootstrap(true) 
#4 /var/www/html/cake271/app/webroot/index.php(104): include('/var/www/html/c...') 
#5 /var/www/html/cake271/index.php(41): require('/var/www/html/c...') 
#6 {main} thrown in /var/www/html/cake271/lib/Cake/Cache/Cache.php on line 186

と表示された。

Fatal errorから解決する

Fatal errorから解決してみる。

まずはサーバにログインして、管理者権限にスイッチする。

cd /var/www/html/cake271/app

でディレクトリを移動。

chown -R apache tmp
chmod -R 755 tmp

を順番に実行して、

ls -l

すると

drwxr-xr-x 6 apache    hoge 4096  7月 27 16:18 2015 tmp

みたいな感じに変更されたのが確認できた。

冒頭で表示されていたCacheに関するエラーは解消された。