人気ブログランキング | 話題のタグを見る
mytips.exblog.jp ブログトップ

PHP4でDOMを扱う domxml_open_mem
FreeBSDで、domを使えるようにPHPを再セットアップ。

phpのコンパイルで必要なオプションは

--with-zlib-dir=/usr
--with-xml
--with-dom=/usr/local

portsを使って管理しているのでPHP4のディレクトリ

cd /usr/ports/lang/php4
(久々に使うので一旦「cvsup -g -L 2 /root/ports-supfile」で更新をかけてから)

で、Makefileを編集(バックアップをとっておく)
上記3つを追加して
CONFIGURE_ARGS= 
のところを編集

で、
まず、念のためクリア
make clean
make configure
make
ここでエラーがでます

------------------------
/usr/local/include/libxml2/libxml/encoding.h:28: iconv.h: No such file or directory
In file included from /usr/local/include/libxml2/libxml/parser.h:796,
from /usr/ports/lang/php4/work/php-4.4.1/ext/domxml/php_domxml.h:25,
from /usr/ports/lang/php4/work/php-4.4.1/ext/domxml/php_domxml.c:33:
/usr/local/include/libxml2/libxml/encoding.h:136: syntax error before `iconv_t'
----------------------------------------

ここで結構はまりました。
要は、「No such file or directory」な訳ですからコンパイルされる際のincludeされるところに、リンクを作ってあげます。
自分の環境では、
ln -s /usr/local/include/iconv.h /usr/local/include/libxml2/iconv.h
ls -l /usr/local/include/libxml2/iconv.h
として確認してみます。

この解決方法に至まで、iconvやlibxml2、libxsltなんかまで入れ替え(バージョンアップ)しましたが、まぁそれはヨシ。
(portsでモジュールを探すときは、whereis iconv などでパスが分かります)

で、シンボリックリンクをつくったところで、
make
make install
(ここでも、前のが残っているとのエラーメッセージなので一旦削除)
make deinstall
make install
apacheを再起動
apachectl restart

で、php_info()のページで確認
configは、下記。 また動作していることも確認できました
'./configure' '--enable-versioning' '--enable-memory-limit' '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php' '--with-zlib-dir=/usr' '--with-xml' '--with-dom=/usr/local' '--disable-all' '--with-regex=php' '--with-apxs=/usr/local/sbin/apxs' '--prefix=/usr/local' 'i386-portbld-freebsd4.11'


1日くらい結構はまりました。ネットを探してもズバリの回答を得られず。
しかし、No such file or directoryのときは、適切なパスを探して、リンクを作るのがいいみたい。
by sato025 | 2006-01-12 02:17 | FreeBSD


by fd


var gaJsHost = (("https:" == doc ument.loc ation.protocol) ? "https://ssl." : "http://www.");doc ument.write(unesc ape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));var pageTracker = _gat._getTracker("UA-103429-5");pageTracker._trackPageview();