Mark Bucciarelli wrote:
On Tue, Sep 27, 2005 at 11:16:04AM +0200, [EMAIL PROTECTED] wrote:
Mark Bucciarelli wrote:
Is it possible install both php4 and php5 on the same server using
ports?

I'm using fastcgi so two different interpreters should be fine. (Rename /usr/local/bin/php to /usr/local/bin/php5-fcgi, for example.)

Can I assume the php4 and php5 modules (for example, pear) won't step on
each other's toes?

I google around but didn't find much on this topic ... :(

m
We have them as mod with two chrooted Apache servers on two different IPs.

Thanks for the reply.

From doing some more research list night, my understanding is that
the php binary is the whole kit and kaboodle, so if I
- build PHP4 from source and

- configure it to look in a different spot for extensions,

then I should be able to use PHP4 and PHP5 via fastcgi on a per-vhost
basis.

I just won't be able to rely on ports for updates to PHP4.

m

I found a way to do it where I can install both php instances from ports. In my case I am using php5-cli (command line interpreter) as well as php5-cgi (compiled for fast cgi) both installed from ports. php5-cli is installed into the normal directories under /usr/local. php5-cgi is installed into an alternate base directory /usr/local/alt.

Basically, you can use the PREFIX environment variable to tell the ports system to use an alternate base directory for installation. This works with portupgrade as well.

Here are some notes that I took when I was setting this up. Note that I'm using portupgrade (hence the reference to /usr/local/etc/pkgtools.conf)...

== Install PHP5 with fastcgi support ==

In order to have an alternative fastcgi version of php, we need to install it to an alternate location.

First this to /usr/local/etc/pkgtools.conf:
{{{
MAKE_ARGS {
    'php5-cgi*' => 'WITH_APACHE2=yes WITH_FASTCGI=yes'
}
}}}

Assuming that we already have php5 for cli and apache installed, we can install an alternate fastcgi enabled version like this:

{{{
$ su -
$ mkdir /usr/local/alt
$ export PREFIX=/usr/local/alt
$ script /usr/local/alt/install.log
$ portupgrade -pNi www/php5-cgi
$ exit # (exit script)
$ exit # (exit su)
}}}

There can be a few little problems with this process. Here is the preliminary report:

==== Modules not loaded ====

php5-cgi installed fine into the alternate prefix, but it didn't know about any of the extensions (modules) that the main php install had.

To fix this, I pointed the new php5-cgi at the main php instance's modules. '''I believe that this will only work if both instances of php5 are the exact same version'''

Here is what I did:
{{{
$ cd /usr/local/alt/etc
# /usr/local/etc/php is a directory that contains an 'extensions.ini' file.
# The 'extensions.ini' file lists the extensions that should be loaded.
$ ln -s /usr/local/etc/php php
}}}

- Sam Nilsson
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to