Re: Apache handler with Multiple PHP versions

php.internals

Gaetano Giunta

19 years ago
> On 7/12/07, chris# <chris#@codewarehouse.net> wrote: >> >> >> >> On Thu, 12 Jul 2007 11:38:44 +0200, Tijnema <tijnema@gmail.com> wrote: >> > Hello Richard, >> > >> > On 7/12/07, Richard Lynch <ceo@l-i-e.com> wrote: >> >> On Wed, July 11, 2007 6:13 pm, Tijnema wrote: >> >> > On 7/12/07, Jani Taskinen <jani.taskinen@sci.fi> wrote: >> >> >> A lot easier (and works already) is to install PHP as CGI/FastCGI >> >> >> (one version or all of them, one can be module of course) and define >> >> >> the >> >> >> required PHP version by the file suffix.. >> >> >> >> >> >> --Jani >> >> > >> >> > Hello Jani: >> >> > >> >> > I know this is possible, and I believe it is possible in Apache too >> >> > with some kind of hack? >> >> > But this still doesn't solve a lot of problems, but will generate a >> >> > lot more with portable code. Take a bulletin board for example, there >> >> > are a lot of files inside a board, and when you want to install that >> >> > on your host that has PHP5 for files with .php5, you need to rename a >> >> > hell lot of files to .php5, AND change code inside the .php5 files to >> >> > point to the renamed files. >> >> >> >> No, you add a <Directory> config in httpd.conf or add to .htaccess a >> >> line like >> >> <Files ~.php> >> >> ForceType whatever/gets/you/to/php-5 >> >> </Files> >> > >> > 1) Did you ever see a shared host that has multiple versions >> > configured like this? >> > 2) This will end up to be confusing for the end user, as they will >> > need to create the .htaccess file (as most users don't have write >> > rights for httpd.conf) >> This is no more unusual that adding/eliminating directory access. >> Which is pretty common stuff for users on a hosting companies box. >> Extremely simple too. The hosting outfit will /surely/ indicate >> any changes they need to make to provide them with the /added/ >> functionality. Maybe even add an applet in the Cpanel for it. > > My host hasn't a single .htaccess file ;) > (Using DirectAdmin..)
Not really an excellent option for web hosters, but the easiest way I set up "alot" of php versions on my dev box (1 as apache module, all the rest cgi, of course) is using virtual hosts: every virtual host listens to either a different port or a different server name, eg: php4server.my.domain, and binds .php and .inc files to a different cgi app/php version. This way there is no need to rename files or keep multiple copies around, and it is pretty useful eg. for heavy unit testing: if the code does not work in a particular php version, add some hackish ifdef equivalent and you're done. Bye Gaetano