Page 1 of 1

PHP 4 and PHP 5 together ?

Posted: Tue Feb 22, 2005 2:19 am
by anjanesh
Im using PHP 4.3.10 because my host uses it.
1. But now I want to try out PHP 5.0.3 without removing PHP 4.3.10. Is that possible ?
2. Is it possible to configure in Apache to handle both PHP 4.x and PHP 5.x types ? Say PHP 4.x files are having .php extension and PHP 5.x files have .php5 extension ?
C:\PHP => PHP 4.3.10 package
C:\PHP5 => PHP 5.0.3 package
3. If IT IS then how'll I get to have 2 php.ini files in C:\Windows - one for each ?
4. If all the above as possible then is it possible to club a PHP 4 code and a PHP 5 code in a single script like:

Code: Select all

<?php
// PHP 4 code
?>
<hr>
<?php5
// PHP 5 Code
?>
Thanks

Posted: Tue Feb 22, 2005 8:48 am
by feyd
  1. yes
  2. yes
  3. you place them in differing locations and tell php where to look I believe
  4. not directly possible

Posted: Wed Feb 23, 2005 4:35 am
by Weirdan
yes, it's possible to have such setup (except mixing two flawors of php in the same file). Last time I tried to acomplish this I had to set both interpreters as a CGI (because I used PHPRC env. variable to control the location of php.ini) and then it worked flawlessly.

something like this:

Code: Select all

#excerpt from httpd.conf
    
    # PHP Handling

    # PHP 4
    AddType application/x-httpd-php .php
    ScriptAlias /php4/ "e:/php4/"
    SetEnvIf Request_URI "\.php$" PHPRC=e:/php4/php.ini
    Action application/x-httpd-php "/php4/php.exe"

    # PHP 5
    AddType application/x-httpd-php5 .php5
    ScriptAlias /php5/ "e:/php5/"
    SetEnvIf Request_URI "\.php5$" PHPRC=e:/php5/php.ini
    Action application/x-httpd-php5 "/php5/php-cgi.exe"

Posted: Wed Feb 23, 2005 7:13 am
by anjanesh
Wow. I defintely got to try this (hopefully no crash). If it can work as cgi then it defintely should work as a module. Let me try with as module and post the result here.
Thanks