[PHP-users 33428] php5(モジュール版)とphp4(CGI)版の共存

Hiroshi Ishiura issy777 @ e-entrance.org
2008年 3月 28日 (金) 08:56:28 JST


石浦と申します。
久しぶりの投稿です。

今php5とphp4の共存環境を作ろうとしているのですが、php4(CGI版)がエラー
がでてうまく動きません。

参考にさせて頂いたサイトはこちら
http://hain.jp/index.php/tech-j/2006/11/20/p82
http://wiki.poyo.jp/read/Writing/kiwameru_php_vol.1/php4_and_php5/20.01.cgi

サーバ環境は以下の通りです。
CentOS 5.0
Apache/2.2.3 (CentOS)
PHP5.2.5 (Apacheモジュール版)
 /usr/local/bin/php
 /usr/local/lib/php.ini
この環境に以下のphp4をCGI版でインストールしました。

PHP4.4.8 (CGI/FastCGI版)
 /usr/local/php4/bin/php
 /usr/local/php4/lib/php.ini
インストールオプション
./configure '--prefix=/usr/local/php4' '--enable-fastcgi'
'--enable-force-cgi-redirect' '--enable-mbstring' '--enable-mbregex'
'--enable-zend-mutibyte' '--with-pgsql=/usr/local/pgsql'
'--with-mysql=/usr/local/mysql'
'--with-mysqli=/usr/local/mysql/bin/mysql_config' '--enable-track-vars'
'--enable-trans-sid' '--with-gd' '--enable--gd-native-ttf'
'--with-ttf=/usr' '--with-png-dir=/usr' '--with-jpeg-dir=/usr'
'--with-freetype-dir=/usr' '--with-zlib-dir=/usr' '--with-openssl'
'--enable-ftp' '--with-curl' '--with-mcrypt' '--enable-exif'
'--enable-sockets'

/usr/local/php4/bin/phpを/var/www/cgi-bin/phpにシンボリックリンク

httpd.confに以下
Action php4-script /cgi-bin/php
AddHandler php4-script .php4

CGI版で動かしたいディレクトリの.htaccessファイルに
AddHandler php4-script .php

以上の設定でブラウザからphpinfo()を実行したところ
Warning: Unexpected character in input: '
' (ASCII=30) state=1 in /usr/local/php4/bin/php on line 315
Parse error: syntax error, unexpected T_STRING in /usr/local/php4/bin/php on line 315
というエラーが表示されてしまいました。
インストールオプションを必要最低限のものに削ったりすると行番号は変わるも
ののエラー内容は同じでした。characterエラーですので文字コードの関連あた
りに問題がありそうな気もするのですが、原因を特定できない状況です。

参考になるかわかりませんが、make中に眺めていると
/usr/local/src/php-4.4.8/ext/mbstring/mbstring.c:152: 警告: initialization discards qualifiers from pointer target type
このような警告がmbstring関係で出ています(make,make install自体は成功し
ている)

またコマンドラインからこのphp4のCGI版を
/usr/local/php4/bin/php phpinfo.php
このように実行すると問題なくphpinfoの情報が出力されました。
なのでコマンドライン上では問題ないのだと思います。

原因と解決する方法はありますでしょうか?
よろしくお願いします。


-- 
Hiroshi Ishiura <issy777 @ e-entrance.org>



PHP-users メーリングリストの案内