Linux サーバ構築 ( Fedora Core5 ) - PHP + Smarty

Smarty のインストールと設定

Smarty のインストールと基本設定です。

  1. Smarty のインストール
    # yum install php-Smarty
    
    Installed: php-Smarty.noarch 0:2.6.13-1.fc5
    Complete!
  2. php の include_path の 追加設定
    /etc/php.ini ( 抜粋 )
    ;;;;;;;;;;;;;;;;;;;;;;;;;
    ; Paths and Directories ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;
    
    ; UNIX: "/path1:/path2"
    ;include_path = ".:/php/includes"
    include_path = ".:/usr/share/pear:/usr/share/Smarty" 行編集
    
  3. httpd デーモンの再起動
    # /etc/init.d/httpd restart
    
  4. Smarty 用のディレクトリを作成
    # mkdir -p /var/www/html/smarty 環境に合わせて変更してください
    # cd /var/www/html/smarty
    # mkdir templates templates_c configs cache Smarty 用に4つのディレクトリを作成
  5. Smarty_App クラスファイルの作成
    /var/www/html/smarty/Smarty_App.php
    <?php
    //
    // include_path defined in php.ini
    //
    require_once 'Smarty.class.php';
    
    class Smarty_App extends Smarty {
      private $smartyAppBase = '/var/www/html/smarty';
      public function __construct() {
        parent :: __construct();
    
        $this->template_dir    = $this->smartyAppBase.'/templates/';
        $this->compile_dir     = $this->smartyAppBase.'/templates_c/';
        $this->config_dir      = $this->smartyAppBase.'/configs/';
        $this->cache_dir       = $this->smartyAppBase.'/cache/';
    
        $this->caching = true;
      }
    }
    ?>
  6. smarty ディレクトリの所有権の変更
    # chown -R apache:apache /var/www/html/smarty
  7. smarty ディレクトリの内容確認
    # ls -al /var/www/html/smarty
    
    drwxr-xr-x 6 apache apache 4096  5月 26 17:34 .
    drwxr-xr-x 3 apache apache 4096  5月 26 17:34 ..
    -rw-r--r-- 1 apache apache  539  5月 26 16:32 Smarty_App.php
    drwxr-xr-x 2 apache apache 4096  5月 26 17:02 cache
    drwxr-xr-x 2 apache apache 4096  5月 26 16:01 configs
    drwxr-xr-x 2 apache apache 4096  5月 26 16:59 templates
    drwxr-xr-x 2 apache apache 4096  5月 26 17:02 templates_c
( 最終更新日時 : 2008/08/31 21:24:47 )

Site Info

so_counter

Reference

コミットメント

SYSTEMO 宣言

お客様の喜びは、私たちの喜びです。

私たちは
道具としてのITが
お客様のお役に立つことを
心から願っています。

私たちは
SOHOビジネスを
支援します。

運営サイト

商品検索エンジンでオンラインショッピング・インターネット通販を楽しもう
商品検索エンジン【Jトレンズ】
商品検索 by Webサービス
【あいてむず】
  Webサービス ショップリンク サイト

社長Blog
アフィリエイトことはじめLabo
社員Blog
やりくり主婦の
  ほしい☆たべたい☆つかいたい