PHPの設定
PHPは特に設定は必要がない /etc/php.iniの編集 古いサンプルスクリプトなどを実行するなら下記の設定をOnにする (PHP4.2.0から外部変数の取り扱いが変わっているため) # gedit /etc/php.ini 312行目付近 register_globals = Off ↓ register_globals = On ただしセキュリティホールになるので、公開サーバーではOffにして、 EGPCS(Environment, GET, POST, Cookie, Server)変数を指定するほうがよい Red Hat 9だとphp-4.2.2ですが、デフォルトだと日本語変換系の関数が使えません 例:mb_language mbstring extensionっぽい話です Safe mode 不特定のユーザーがある場合はSafe modeにする # gedit /etc/php.ini 158行目付近 safe_mode = Off ↓ safe_mode = On 469行目付近 sql.safe_mode = Off ↓ sql.safe_mode = On httpdを再起動する # service httpd restart PHPの動作を確認する ドキュメントディレクトリ(Webで公開されるディレクトリ)に次の内容のファイル(ファイル名『test.php』)を作成する <?php phpinfo(); ?> ブラウザで下のアドレスを開く http://localhost/test.php PHPのバージョン・設定内容の画面が出れば設定は終了--with-gd --enable-gd-jis-conv --enable-gd-native-ttf --with-imap --with-ldap --with-ldap-sasl
--with-gd=/path/to/gd
--with-jpeg-dir=/path/to/libjpeg
--with-zlib-dir=/path/to/zlib
http://www.boutell.com/gd/
http://freetype.sourceforge.net/old_index.html
http://hotwired.goo.ne.jp/webmonkey/2001/36/index4a_page2.html
http://ponk.jp/linux_memo/index.php?page=2
libjpeg インストール
http://www.ijg.org/
$ tar -zxvf jpegsrc.v6b.tar.gz
$ cd jpeg-6b/
$ ./configure --enable-shared
$ make
$ su
# mkdir /usr/local/include
# make install
zlib インストール
http://www.zlib.net/
tar xvzf zlib-1.2.2.tar.gz
cd zlib-1.2.2
./configure --shared --prefix=/usr
make
make test
make install
libpng インストール
$ tar xzvf libpng-1_0_2_tar.gz
$ cd libpng-1.0.2
$ cp scripts/makefile.std makefile
$ chmod +w makefile
上記の最後ののコマンドは,これから編集したいmakefileがリードオンリー・ファイルになっている(makefile.stdがリードオンリー・ファイルになっているから)ので必要です.makefileを以下のように書き換えてください(この場合,libz.aが/usr/local/libに,zlib.hとzconf.hが/usr/local/includeに在るものとします).
#ZLIBLIB=/usr/local/lib → ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include → ZLIBINC=/usr/local/include
ZLIBLIB=../zlib → #ZLIBLIB=../zlib
ZLIBINC=../zlib → #ZLIBINC=../zlib
CC=cc → CC=gcc
makefile編集後,libpng-1.0.2ディレクトリで以下のコマンドを入力します.
$ make test
$ make install
**************************************************************************
GD
zlibのインストール
zlibはzipやgzipに採用されている圧縮アルゴリズムをライブラリ化したもの。
http://www.gzip.org/zlib/よりダウンロード
tar zxf zlib-1.1.4.tar.gz
cd zlib-1.1.4
./configure --shared
make
make install
libjpegのインストール
http://www.ijg.org/よりダウンロード
tar zxf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --enable-shared
make
make install
libpngのインストール
http://www.libpng.org/pub/png/libpng.htmlよりダウンロード
tar zxf libpng-1.2.5.tar.gz
cd libpng-1.2.5
configure が使えないので手動で makefile を作成する。
cp scripts/makefile.linux makefile v vi makefile
以下の部分を
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
ZLIBLIB=../zlib
ZLIBINC=../zlib
以下のように書き換える
ZLIBLIB=/usr/local/lib
ZLIBINC=/usr/local/include
#ZLIBLIB=../zlib
#ZLIBINC=../zlib
コンパイル・インストール。
make
make install
FreeTypeのインストール
http://www.freetype.org/よりダウンロード
tar zxf freetype-2.1.5.tar.gz
cd freetype-2.1.5
./configure
make
make install
GDのインストール
http://www.boutell.com/gd/よりダウンロード
tar zxf gd-2.0.15.tar.gz
cd gd-2.0.15
./configure
make
make install
PHPのオプションを変更
以下を追加。
--with-zlib-dir=/usr/local/lib --with-gd --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib
ln -s /usr/lib/libpng.so.3 /usr/lib/libpng.so
ln -s /usr/lib/libjpeg.so.62.0.0 /usr/lib/libjpeg.so
rpm -ivh libpng-devel.rpm
XML
--with-dom
DOM XML関数を有効にする。libxmlが必要。
DOM関数を使うだけならこのオプションだけでOKかも。
--enable-xslt
--with-xslt-sablot
PHPでXSLT関数をサポートする(Sablotronを使う)
XMLパーサとプロセッサをインストールするには、expat, Sablotronの順にインストールする。Sablotronのconfigureは、LDFLAGS=' -lstdc++' ./configure
--with-dom-xslt
DOM XSLT関数を有効にする。libxsltが必要。
--with-zlib
ZLIBを有効にする。libzが必要。