PHP4, PHP5, PHP6自由选择

  2008-08-03


今天给服务器装起了PHP4, PHP5, PHP6,并且可以让用户通过.htaccess自由选择PHP版本。同时也对mod_fcgid的的用法有了更深入的了解。

安装方法
PHP4:
http://blog.eaxi.com/wiki/index.php/Installing_PHP4

PHP5:
http://blog.eaxi.com/wiki/index.php/Installing_PHP5

PHP6:
http://blog.eaxi.com/wiki/index.php/Installing_PHP6

使用方法

把后缀.php4的文件定义为PHP4文件。
AddType application/x-httpd-php .php4
AddHandler php4-script .php4
Action php4-script /php4-bin/php-cgi

把后缀.php5的文件定义为PHP5文件。
AddType application/x-httpd-php .php5
AddHandler php5-script .php5
Action php5-script /php5-bin/php-cgi

把后缀.php6的文件定义为PHP6文件。
AddType application/x-httpd-php .php6
AddHandler php6-script .php6
Action php6-script /php6-bin/php-cgi

系统默认使用PHP5来解析.php的文件,你可以覆盖这个设置,用其他版本PHP来解析.php文件。
AddType application/x-httpd-php .php
AddHandler php-script .php
Action php-script /php5-bin/php-cgi

前提
Apache必须有mod_actions, mod_fcgid支持。

DEMO:

http://u.eaxi.com/phpinfo.php4
http://u.eaxi.com/phpinfo.php5
http://u.eaxi.com/phpinfo.php6
http://u.eaxi.com/phpinfo.php

请留言报告BUG。。呵呵!