プロが教える店舗&オフィスのセキュリティ対策術

プログラム初心者なのですが、以下教えて頂けないでしょうか。
さくらレンタル(スタンダード)にsmartyを設置を試みているのですが、エラーメッセージが出てしまいます。
環境:PHP 5.2.6 / Smarty 2.6.19

/home/(アカウント)/www/libs/smartyの直下にSmarty.class.php以下、公式サイトからダウンロードしたものをそのままアップし、/home/アカウント/www/smartytest/helloの直下に以下のファイルをアップしました。
(index.php)
<?php
define('SMARTY_DIR','/home/アカウント/www/libs/smarty/');
define('SMARTY_TEST','/home/アカウント/www/smartysample/hello/');
require_once(SMARTY_DIR.'Smarty.class.php');
$smarty = new Smarty;

$smarty->template_dir = SMARTY_TEST.'templates/';
$smarty->compile_dir = SMARTY_TEST.'templates_c/';
$smarty->config_dir = SMARTY_TEST.'configs/';
$smarty->cache_dir = SMARTY_TEST.'cache/';

$smarty->assign('msg','Hello World!');
$smarty->display('index.tpl');
?>

そして、このindex.phpにアクセスすると、下記のようなエラーメッセージが表示されます。
Warning: Smarty::require_once(/home/アカウント/www/libs/smarty/internals/core.write_compiled_resource.php) [smarty.require-once]: failed to open stream: No such file or directory in /home/アカウント/www/libs/smarty/Smarty.class.php on line 1429

Fatal error: Smarty::require_once() [function.require]: Failed opening required '/home/アカウント/www/libs/smarty/internals/core.write_compiled_resource.php' (include_path='.:/usr/local/php-5.2.6/lib/php') in /home/アカウント/www/libs/smarty/Smarty.class.php on line 1429

Smarty.class.phpの1429行目に問題があるのかとファイルを開いてみたものの、初心者のためよく理解できません。あと、Smarty.class.phpを呼び出すのに絶対パスを指定しているのは、さくらの管理画面からphp.iniでinclude_pathを指定しようとしても、うまくいかなかったためです(上記の場合、$smarty = new Smarty;を削除すれば、エラー画面は表示されません。変わりに何も表示されませんが・・)。

初心者のため、基本的なところで見落としがあるのかもしれませんが、教えて頂ければと思います。どうか、宜しくお願いします。

A 回答 (1件)

template_cディレクトリの所有者やパーミッションはどうなっていますか?



template_cディレクトリにPHPの実行者(多分Apacheになるのかな・・?)に書き込み権限を与えてみてください。

もしくは、全て許可するとか・・・
chmod -R 777 template_cのデイレクトリパス
    • good
    • 0
この回答へのお礼

usb_memory様

ご回答、ありがとうございます。その後、こちらで調べましたところ、smarty関連のアップしたファイルの中に、一部漏れがありました。改めて全てアップしなおしたところ、無事作動しました。

また、回答が遅れまして、失礼いたしました。

お礼日時:2008/09/03 22:34

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!