押入れ起業

ガレージベンチャー、ならぬ。もっぱらPHPプログラミングとアフィリエイトの研究をしています。

PEARのメモ

xdomainサーバでPEAR::Cache_Liteを使う

投稿日:2015-02-14 更新日:

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 を置いてアクセス禁止にした。

  • Manual :: Cache_Lite
  • PC

    PC

    -PEARのメモ
    -, ,

    執筆者:


    comment

    メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

    関連記事

    PEAR

    simplexml_load_fileで取得したxmlデータをPEAR::Cache_Liteで保存するとエラーになる対策

    Web APIからsimplexml_load_fileで取得したxmlデータをPEAR::Cache_Liteで保存するとエラーになる件 データ取得をfile_get_contentsで行い、そのま …

    open all | close all
    open all | close all