Re: php 4 & php 5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Lynch wrote:
timothy johnson wrote:

Is there a way to install two version of php on the same machine, and
use them for two different users?


Option 1:
Install two copies of Apache, with different httpd.conf files, on two
different ports.
Somebody gets stuck using http://example.com:81 (or any port but 80) but
this gives everything you asked for.

Option 2:
Use --enable-versioning while compiling PHP.  This definitely allowed for
PHP3 and PHP4 and *might* allow for 4&5...  Or not.  RTFM
But you won't get different Users.

Option 3:
Install at least one of the two as CGI (fastCGI, whatever), and use a
different extension (.php4 or .php5) or use other means (ForceType,
AddHandler, AddType, etc) to change which is used on a per directory
basis. Use suexec, if you UNDERSTAND THE RAMIFICATIONS to alter the user
of the CGI process. Mis-use of suexec is incredibly dangerous. YMMV NAIAA IANAL
The CGI usage will lose some minimal functionality. HTTP Authentication
springs to mind, but there are 3 or 4 functions/features that just plain
won't work in CGI. RTFM


Option 4:
In terms of expenses/headaches, you will probably be better off just
buying a second machine.  Problem solved.

Running 2 Apache instances is by far the easiest solution. And to make it invisible to the end user you can ProxyPass connections from your port 80 server to your port 81 or whatever port you put it on. For example, I have a test app giving PHP 5.1 and the Yahoo Web Services a workout on a server that also has a bunch of PHP4 stuff.


The URL is: http://buzz.progphp.com
This is actually being served off of a port 81 server. The port 80 conf file has this entry in the buzz vhost:


ProxyPass / http://buzz.progphp.com:81/

Then in the port 81 server I just have a standard vhost config for buzz listening on port 81.

If you go to the HTTP Headers block of:

http://buzz.progphp.com/info.php

You can see that you end up with:

Host: buzz.progphp.com:81
Via: 1.1 buzz.progphp.com (Apache/1.3.33)
X-Forwarded-For: 24.6.1.160
X-Forwarded-Host: buzz.progphp.com
X-Forwarded-Server: buzz.progphp.com

So the only thing you may need to change in an application running behind ProxyPass is if you have $_SERVER["REMOTE_ADDR"] somewhere. Change that to use $_SERVER["HTTP_X_FORWARDED_FOR"] instead.

-Rasmus

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux