PHP - smarty2 から smarty3 へ - インストール

クラウディア 
1. 概要
2. インストール
3. 設定

1. 概要

 以前は、テンプレートエンジンとして、「smarty」を使用していましたが、現在は、ウェブアプリケーションフレームワークとして、「Laravel」を使用することが多くなったので。  「smarty」は、ほとんど使うことがなくなったのです。  久々に、いじる機会があったのですが、そういえば、インストールや設定について、メモしていなかったかもしれないと思い立ち。  このページを書いています。  以下。「FreeBSD 14.0 RELEASE」へ、「smarty3」をインストールする手順です。  「apache」や「php」は、インストール済です。  「PHP」は、「PHP 8.2.13」をインストールしています。

2. インストール

 「root」ユーザ権限で。

cd /usr/ports/www/smarty3
make
make install
 オプションは、ありません。  「make」も「make install」も秒殺でした。  インストール時のメッセージを残しておきます。

===>  Installing for smarty3-php82-3.1.48
===>  Checking if smarty3-php82 is already installed
===>   Registering installation for smarty3-php82-3.1.48
Installing smarty3-php82-3.1.48...
You need to adjust php's include_path to contain /usr/local/share/smarty3-php82!
For example, insert
        include_path = ".:/usr/local/share/smarty3-php82"
into /usr/local/etc/php.ini.

3. 設定

 インストール時のメッセージにあるように、設定します。

vi /usr/local/etc/php.ini
 745行目を有効化して。

;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"

include_path = ".:/usr/local/share/smarty3-php82"
 と書くわけですが。  既に、何かの記述がある場合は、末尾の「"」の前に、「:/usr/local/share/smarty3-php82」だけ追加します。  書き終わったら、「apache」をチェックして再起動します。

service apache24 configtest

service apache24 restart
earthcar(アースカー)