LoginSignup
0
0

More than 5 years have passed since last update.

いまさらPHP4+Apache1.3を導入する

Last updated at Posted at 2013-07-15

あまりやりたくはないのですが、お仕事的な事情でPHP4を入れないといけなくなりました。cgiで動かして同居するのもあったけど、嫌いなのでがんばってコンパイルしました。

その時のメモ

Dist: Ubuntu12.04LTS

Apache2 + PHP5をメインにvirtualhost+proxy構成でApache1.3+PHP4にproxyする。
apache2と+php5はaptitude からどうぞ。

先にapache1.3からインストールします。

$sudo aptitude install build-essential
$ wget http://archive.apache.org/dist/httpd/apache_1.3.42.tar.bz2
$ tar bzip2 -dc apache_1.3.42.tar.bz2 | tar xvf -
$ cd apache_1.3.42

configureの途中で落ちるので、ライブラリをaptitudeで入れて強引にsymlinkを貼る。結局makeは通るけど、該当モジュールでエラーが起きるのでwithoutしてもよかったかも

$ sudo aptitude install libgdbm-dev
$ ln -s /usr/include/gdbm-ndbm.h /usr/include/ndbm.h
$ ./configure --enable-module=most --enable-shared=max
$ make

getline周りでエラーがおきるのでさらに対応。

$ sed -i 's/getline/apache_getline/' src/support/htdigest.c
$ sed -i 's/getline/apache_getline/' src/support/htpasswd.c
$ sed -i 's/getline/apache_getline/' src/support/logresolve.c
$ make
$ make install

/usr/local/apache以下にインストールされる。起動するにはapachectlをつかって行います。

$ sudo /usr/local/apache/bin/apachectl start

さて、さっきのmoduleがずっこけるので設定をコメントアウト。あわせて80以外ポートにします。

/usr/local/apache/conf/httpd.conf
Listen 8080
Port 80

#LoadModule dbm_auth_module    libexec/mod_auth_dbm.so
#AddModule mod_auth_dbm.c

User www-data
Group www-data

<VirtualHost *:8080>
    ServerAdmin webmaster@example.com
    DocumentRoot /var/www
    ServerName php4.example.com
...
</VirutalHost>


この2つをコメントアウトすると起動します。ポート番号は8080にして、apacheの起動ユーザーをapache2と一緒のwww-dataに指定。そうしないとちょっとlog周りでややこしくなっちゃう。

引き続きphpのインストール

$ wget http://uk.php.net/distributions/php-4.4.9.tar.gz
$ ./configure --with-apxs=/usr/local/apache/bin/apxs --enable-mbstring   --enable-zend-multibyte --with-pgsql --with-mysql
$ make
$ make install

これで基本的にapache1.3のmoduleでインストールされます。
あとはapache2のvirtualhostで設定。

/etc/apache2/site-available/php4.example.com.conf
        ServerName      php4.example.com
        ProxyPass         / http://localhost:8080/
        ProxyPassReverse  / http://localhost:8080/

これで動くようになったけど、マジロストテクノロジーすぎるw

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0