Linux サーバ構築 ( Fedora Core5 ) - PHP + Smarty
Smarty のインストールと設定
Smarty のインストールと基本設定です。
- Smarty のインストール
# yum install php-Smarty Installed: php-Smarty.noarch 0:2.6.13-1.fc5 Complete!
- php の include_path の 追加設定
/etc/php.ini ( 抜粋 )
;;;;;;;;;;;;;;;;;;;;;;;;; ; Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;; ; UNIX: "/path1:/path2" ;include_path = ".:/php/includes" include_path = ".:/usr/share/pear:/usr/share/Smarty" 行編集
- httpd デーモンの再起動
# /etc/init.d/httpd restart
- Smarty 用のディレクトリを作成
# mkdir -p /var/www/html/smarty 環境に合わせて変更してください # cd /var/www/html/smarty # mkdir templates templates_c configs cache Smarty 用に4つのディレクトリを作成
- 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; } } ?>
- smarty ディレクトリの所有権の変更
# chown -R apache:apache /var/www/html/smarty
- 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 )