未だにPHP4のシステムがあります。イントラで使用されているシステムなんですが、塩漬け状態です。サーバー更新のため、CentOS6.10 64bit に PHP4 apache2.2 64bit PostgreSQL9 64bit をインストールしましたので、メモです。
とりあえず、yum でインストール
yum -y install fuse fuse-libs fuse-devel scons gcc rpm-build flex libcurl-devel libxml2-devel libjpeg-turbo-devel libpng-devel freetype-devel httpd httpd-devel mod_ssl
PostgreSQLのインストール設定
ソースファイルからインストール
cd /usr/local/src
wget https://ftp.postgresql.org/pub/source/v9.6.14/postgresql-9.6.14.tar.gz
tar xvfz postgresql-9.6.14.tar.gz
adduser postgres
passwd postgres
mkdir /usr/local/pgsql
chown postgres.postgres /usr/local/pgsql
chown -R postgres.postgres postgresql-9.6.14
su - postgres
cd /usr/local/src/postgresql-9.6.14
./configure --prefix=/usr/local/pgsql --with-libxml
make && make install
Postgresの起動ファイル編集
vi ~/.bashrc
# Postgresql
PATH="$PATH":/usr/local/pgsql/bin
export POSTGRES_HOME=/usr/local/pgsql
export PGLIB=$POSTGRES_HOME/lib
export PGDATA=$POSTGRES_HOME/data
export MANPATH="$MANPATH":$POSTGRES_HOME/man
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$PGLIB"
PostgreSQLの設定ファイル編集
vi /usr/local/pgsql/data/postgresql.conf
log_destination = 'stderr'
logging_collector = on
log_directory = '/var/log/pgsql/'
log_filename = 'postgresql.log'
log_line_prefix = '%t\t%r\t%d\t'
# 2015.10.30 \バックスラッシュがエスケープとして扱われないため「on」→「off」へ
standard_conforming_strings = off
データベースの初期化と起動
source ~/.bashrc
initdb -E EUC-JP --no-locale -D /usr/local/pgsql/data
pg_ctl -D /usr/local/pgsql/data -o '-i' start
apacheの設定
vi /etc/httpd/conf/httpd.conf
ServerName server:80
AllowOverride All
DirectoryIndex index.html index.html.var index.php
LoadModule php4_module modules/libphp4.so
AddType application/x-httpd-php .htm
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
chkconfig httpd on
chkconfig --list httpd
PHP4 64bit
いよいよ本丸です。CentOS6.10 64bit にPHP4 64bitをインストールします。
cd /usr/local/src
wget https://oscdl.ipa.go.jp/IPAexfont/IPAexfont00401.zip
unzip IPAexfont00401.zip
mkdir -p /usr/share/fonts/ja/TrueType/
cp ./IPAexfont00401/*.ttf /usr/share/fonts/ja/TrueType/
unzip IPAfont00302.zip
cp ./IPAfont00302/*.ttf /usr/share/fonts/ja/TrueType/
cd /usr/local/src
wget https://museum.php.net/php4/php-4.4.9.tar.gz
tar xvfz php-4.4.9.tar.gz
configureでエラーとなるため、configureファイルを編集
cd php-4.4.9
cp -p configure configure.org
vi configure
- if test -f "$i/lib/libjpeg.$SHLIB_SUFFIX_NAME" -o -f "$i/lib/libjpeg.a"; then
- CPDF_JPEG_DIR=$i
+ if test -f "/usr/lib64/libjpeg.$SHLIB_SUFFIX_NAME" -o -f "/usr/lib64/libjpeg.a"; then
+ CPDF_JPEG_DIR=/usr/lib64
- test -f $i/lib/libjpeg.$SHLIB_SUFFIX_NAME -o -f $i/lib/libjpeg.a && GD_JPEG_DIR=$i && break
+ test -f /usr/lib64/libjpeg.$SHLIB_SUFFIX_NAME -o -f /usr/lib64/libjpeg.a && GD_JPEG_DIR=/usr/lib64 && break
- test -f $i/lib/libjpeg.$SHLIB_SUFFIX_NAME -o -f $i/lib/libjpeg.a && GD_JPEG_DIR=$i && break
+ test -f /usr/lib64/libjpeg.$SHLIB_SUFFIX_NAME -o -f /usr/lib64/libjpeg.a && GD_JPEG_DIR=/usr/lib64 && break
- test -f $i/lib/libpng.$SHLIB_SUFFIX_NAME -o -f $i/lib/libpng.a && GD_PNG_DIR=$i && break
+ test -f /usr/lib64/libpng.$SHLIB_SUFFIX_NAME -o -f /usr/lib64/libpng.a && GD_PNG_DIR=/usr/lib64 && break
- if test ! -f $GD_PNG_DIR/include/png.h; then
+ if test ! -f /usr/include/png.h; then
- test -f $i/lib/libjpeg.$SHLIB_SUFFIX_NAME -o -f $i/lib/libjpeg.a && GD_JPEG_DIR=$i && break
+ test -f /usr/lib64/libjpeg.$SHLIB_SUFFIX_NAME -o -f /usr/lib64/libjpeg.a && GD_JPEG_DIR=/usr/lib64 && break
コンパイル、インストール
./configure --enable-mbstring --enable-mbregex --enable-mbstr-enc-trans --with-apxs2=/usr/sbin/apxs --with-pgsql=/usr/local/pgsql --enable-sockets --without-mysql --enable-zend-multibyte --enable-sigchild --enable-ftp -with-zlib --with-gd --enable-gd-imgstrttf --enable-gd-native-ttf --with-ttf-dir=/usr/lib --with-freetype-dir=/usr/lib --with-tiff-dir=/usr/lib --with-jpeg-dir --with-png-dir --enable-gd-jis-conv
make all
make install
コメント