メンテナンス・トラブルシュート - PHP - smarty2 から smarty3 へ

 クラウディア
1. 概要
2. 試行錯誤
3. /usr/local/etc/php.ini 編集
4. ソースの変更

1. 概要

 さて困ったことになったぞ。  本サイトのまったく別のカテゴリで「smarty」を使用しているのですが。

$ pkg version -vl "?"
smarty-2.6.31                      ?   orphaned: www/smarty2
 てなことになっちゃったのだ。

$ whereis smarty
smarty: /usr/ports/sysutils/webmin/work/stage/usr/local/lib/webmin/authentic-theme/unauthenticated/js/codemirror/mode/smarty
$ whereis smarty3
smarty3: /usr/ports/www/smarty3
 うむ、知ってはいたが smarty3 はあるのだ。  参考になりそうなサイトに目を通してみます。
smarty2 から smarty3 に移行する際の注意点」
「[PHP]Smarty3.1 にバージョンアップして困ったこと」
「【メモ】Smarty2 → 3 のハマリどころ
 記事は大抵 2010~2013年ですね、  今、これを書いているのが 2018年3月9日ですから、わたしがずぼらなことがまるわかり・・・。  ほんとはこまめにメンテナンスしなきゃダメなんですけどね。

2. 試行錯誤

 なくなったものを相手に「portupgrade -o」が効くのかどうか・・・。  やってみます。

> portupgrade -o www/smarty2 -f smarty3
[Reading data from pkg(8) ... - 378 packages found - done]
 お、これは叱られなくてすんなり通ったぞ。

> portupgrade -Rr smarty3
[Reading data from pkg(8) ... - 378 packages found - done]
[Exclude up-to-date packages  done]
 なんにも動いていないところを見ると・・・。

$ pkg version -vl "?"
smarty-2.6.31                      ?   orphaned: www/smarty2
 あら、やっぱり駄目だわ・・・。  仕方ない、一時的にサイトがめちゃめちゃになることを覚悟して・・・。

pkg delete smarty
cd /usr/ports/www/smarty3
make
make install
 インストールの時点で

Installing smarty3-php56-3.1.30...
You need to adjust php's include_path to contain `/usr/local/share/smarty3-php56'!
For example, insert
        include_path = ".:/usr/local/share/smarty3-php56"
into `/usr/local/etc/php.ini'.
 てな風に言われてるので

3. /usr/local/etc/php.ini 編集


vi /usr/local/etc/php.ini
 で編集します。

include_path = ".:/usr/local/share/smarty:・・・"
 の箇所を

include_path = ".:/usr/local/share/smarty3-php56:・・・"
 にするわけですな。  書き換えて

service apache24 configtest
service apache24 graceful

4. ソースの変更

 とりあえず、「.php」の

define('SMARTY_DIR', '/usr/local/share/smarty/');
require_once(SMARTY_DIR . 'Smarty.class.php');
 てな具合に書いてる箇所を(なんでこんな書き方しちゃったんだろう・・・)

require_once('Smarty.class.php');
 に変更して。  まだまだエラーが出力されるので

vi /usr/local/etc/php.ini
 で

display_errors = Off
 にして。  後はソースの話になりますので、この続きは「PHP」の方へ。
ハイスピードプラン5G CONNECT