php5.3と5.2の共存

php5.3だとうまく動かないやつがいたのだが、5.3対応するわけにもいかなかったので、5.2環境を作る。

構成

  • php5.3はapache2のモジュール
  • 5.2はCGI

環境

  • ubuntu10.04

5.3のパッケージをインストール
5.2のphpソースを持ってきてコンパイル

./configure --prefix=/usr/local/php-5.2.13 \ --enable-force-cgi-redirect \ --enable-pic \ --enable-inline-optimization \ --with-bz2 \ --with-curl \ --with-freetype-dir=/usr \ --with-png-dir=/usr \ --with-gd \ --enable-gd-native-ttf \ --with-gettext \ --with-ncurses \ --with-gmp \ --with-iconv \ --with-jpeg-dir=/usr \ --with-openssl \ --with-png \ --with-xml \ --with-dom \ --with-dom-xslt \ --with-dom-exslt \ --with-zlib \ --enable-bcmath \ --enable-exif \ --enable-ftp \ --enable-magic-quotes \ --enable-sockets \ --enable-sysvsem \ --enable-sysvshm \ --enable-track-vars \ --enable-trans-sid \ --enable-yp \ --enable-wddx \ --with-pear \ --with-imap-ssl \ --with-kerberos \ --with-ldap \ --enable-memory-limit \ --enable-shmop \ --enable-calendar \ --enable-dbx \ --enable-dio \ --enable-mbstring \ --enable-mbstr-enc-trans \ --enable-mbregex \ --with-config-file-path=/usr/local/lib/php-5.2.13 \ --enable-zend-multibyte \ --with-mysql \ --with-pgsql \ --enable-simplexml \ --libdir=/usr/lib --with-mcrypt

apacheの設定

なかなか5.2.13で動作してくれなかったが、php_flag engine offしたらいけた。これでいいかは全然わからない。。
これで、/var/www/hoge だとphp5.3、/var/www/hoge/hogehoge だとphp5.2で動作する。

 ScriptAlias /php5 /usr/local/php-5.2.13/bin
 <Directory "/usr/local/php-5.2.13/bin">
 AllowOverride None
 Options +ExecCGI -MultiViews
 Order allow,deny
 Allow from all
 </Directory>

 <Directory "/var/www/hoge">
 allow from all
 Options +Indexes
 </Directory>

 <Directory "/var/www/hoge/hogehoge">
        <IfModule mod_php5.c>
            php_flag engine off
        </IfModule>
 AddHandler application/x-httpd-php .php
 Action application/x-httpd-php /php5/php-cgi
 </Directory>
このエントリーをはてなブックマークに追加
Share on Facebook

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>