xdomainサーバでPEAR::Cache_Liteを使おうとしたら色々エラーが出たので、解決するためにやったことの備忘録を書いておこう。
PEAR::Cache_Lite がどこにあるのかわからない・とりあえずインクルードするとエラーが出る
Warning: require_once(Cache/Lite.php) [function.require-once]: failed to open stream: No such file or directory in /home/…(以下略)
Fatal error: require_once() [function.require]: Failed opening required ‘Cache/Lite.php’ (include_path=’.:/usr/share/pear53′) in /home/…(以下略)
→どうやら無いっぽい。よくわからないんで、結局ダウンロードして FTP 公開ディレクトリに pear ディレクトリを作ってアップした。
キャッシュディレクトリを設定するとエラーになる
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/tmp/…(以下略)
→左側のスラッシュを付けなければエラーを出さずに動く。
<?php
//読み込み
require_once(‘pear/Cache/Lite.php’);//設定
$options = array(
‘cacheDir’ => ‘tmp/’
);//オブジェクト作成
$cache = new Cache_Lite($options);?>
pear ディレクトリと tmp ディレクトリに .htaccess を置いてアクセス禁止にした。