Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Multiple versions of PHP
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
simon pants
n00b
n00b


Joined: 30 Apr 2004
Posts: 47

PostPosted: Wed Nov 24, 2004 8:34 pm    Post subject: Multiple versions of PHP Reply with quote

Hi,

Is there any way that by using Apache vhosts that one web-site/cms could use one version of PHP with another using a different one.

My problem is that mainly I use the latest version of PHP; but I have an open-source version of a Volunteer Management System (courtesy of Oxfam) but it's only written for PHP 4.0.6. Yeah, I know its insecure, but I just want to evaluate it before I make the big decision to re-write for latest version.

SimonP
Back to top
View user's profile Send private message
joefish
Guru
Guru


Joined: 27 Jan 2004
Posts: 316
Location: New Zealand

PostPosted: Thu Nov 25, 2004 12:17 pm    Post subject: Reply with quote

I don't know, but I would like to be able to do this too...
Back to top
View user's profile Send private message
joefish
Guru
Guru


Joined: 27 Jan 2004
Posts: 316
Location: New Zealand

PostPosted: Thu Nov 25, 2004 1:24 pm    Post subject: Reply with quote

Actually, I think I've figured it out...

I'll post back soon once I've had a chance to test it (Might be late friday)
Back to top
View user's profile Send private message
joefish
Guru
Guru


Joined: 27 Jan 2004
Posts: 316
Location: New Zealand

PostPosted: Thu Nov 25, 2004 2:55 pm    Post subject: Reply with quote

Well I'm still up - it's 4am and I should be in bed asleep but oh well...

OK, the easiest way to do something like this is use 2 different versions of Apache.

My situation is slightly different to yours, in that I want to run PHP4 and PHP5. To do this, here's what I have done (hopefully this well help you with your needs).

I already had Apache 2.0.52 and PHP 4.3.9 installed (the latest stable packages currently in portage). I wanted two setups, one with Apache 1.3.x and PHP 4.3.x (as this is what my web host uses), and one with PHP5 (I'll use Apache2 with this one).

First, I did
Code:
# emerge =apache-1.3.33

which will get the latest 1.3.x version of apache installed.

Secondly, I did
Code:
# ACCEPT_KEYWORDS="~x86" USE="apache2" emerge mod_php

which will emerge PHP 5.02 (it's in ~arch). The USE="apache2" is important because otherwise PHP5 will only install it's modules for Apache 1.3.

Thirdly, I did
Code:
# emerge mod_php

Which will install PHP 4.3.9 for you. Make sure you don't have 'apache2' in your make.conf USE settings, or othewise add 'USE="-apache2" to the front of this command.

To finish off, I got a message telling me to run something like 'ebuild /var/db/pkg/dev-php/mod_php-4.3.9/mod_php-4.3.9.ebuild config'. Do that, and then don't forget to make sure that the config files have been updated to load the PHP modules on startup. (APACHE_OPTS="-D SSL -D PHP4" - in your /etc/conf.d/apache.conf, and APACHE_OPTS="-D SSL -D PHP5" - in your /etc/conf.d/apache2.conf).

Things to note:
1) The reason I did this with apache 1.3.x and apache 2.0.x, is because that way portage installs the 2 different vesions of apache in different 'slots', allowing both versions to be installed. You may be able to do this with 2 x Apache2 installs, or 2 x Apache installs, but I'm not sure.

2) I think the above also applies to PHP4 and PHP5 - Hopefully however you can get 2 different versions of PHP4 installed. Ask around as I'm not sure, but I hope this post does help you somewhat.

3) I haven't experimented with both apache servers running at once yet, since they're currently both configured to run on port 80, which means the second one wouldn't start. This isn't a problem for me, although I might figure this out later on.

I'll help you as much as I can - I'm not an expert on this, but I'll do my best.
Back to top
View user's profile Send private message
henri
Apprentice
Apprentice


Joined: 15 Nov 2002
Posts: 182
Location: Germany

PostPosted: Tue Nov 30, 2004 8:30 pm    Post subject: Reply with quote

Hi Simon,

I have almost the same problem you have:
I already changed to php5 on our webserver and already modified all our running scripts to run with php5.
This included squirrelmail and a extremely customised version of osCommerce. Modifying all of the software just took me about two hours! - But now I should have a demo for a website with a php content-management-system up until the end of the week and I still can't decide myself for phpnuke, postnuke or xoops ... aaaahhhh ;-)
Yesterday, late aat night, I tried a beta-version of xoops that should run with php5, but it is crippled (O.K., the author wrote that it is and it would be just available for download for testing purposes, but I didn't think it would be that crippled.).

Now I have to decide between installing all of the three cms as stable versions and try to modify them all to make a decision or to also install a php4 version beneath php5 on the server or like joefish wrote to have another version of apache installed along with php4.

I think It's a decision, what is done faster.

Here are my concerns right now:
------------------------------------------------------------
1) What I did to modify my existing apps after upgrading to php5 (example osCommerce):
------------------------------------------------------------
- tail -f /virtual-domains/domainxyz/www/log/error_log
- Open browser and went throught the shop and the admin until the tail showed me an error, then I opened the corresponding php-page and found the line: (example: $myobj = null;)
- Fast search in php.net and google with keyword php5 lead to the solution (example: unset($myobj);)
- Now I didn't check page for page for errors, but did a ...
- find /virtual-domains/domainxyz/www/htdocs/osc -type f -name '*.php' | xargs grep -H -e '= null;'
This showed me any occurence of this error which I fixed then.
- Now I went on testing the osC shop until the next error occured and so on...

If you do it this way, you're pretty fast, as I said, two hours for five different customised shops and squirrelmail! (O.K. Squirrelmail just needed one fix ;-) )

The problem is, I can't really figure out how long it will take expecially for all three cms versions because for example xoops makes a extremely big use of objects. - If I just had one software to test, I woud go this way, I think.

------------------------------------------------------------
2) Install a php4 version beneath php5 just for one virtual domain
------------------------------------------------------------
How to do it? - Don't know exactly right now, but let's see:
I have some own apache mods which I use just in special directories like for example the mod_info module:
<Location /server-info>
SetHandler server-info
<IfModule mod_access.c>
Order deny,allow
Deny from all
Allow from mydomain
</IfModule>
</Location>

I think it should be possible to enable the php4 module kind of like this just for a special virtual host, Location or Directory.

Unfortunately I had this idea just before searching the gentoo forums and finding your thread, so I can't tell you more right now.

But there may be some difficulties like: How to avoid the php5 handler to also handle these pages?

I really have no clue how long it will take to get that running.

------------------------------------------------------------
3) Install a second apache along with php4
------------------------------------------------------------
This will probabely be the fastest version for my needs, but I really don't know if this is a good solution on a production server, but why not?

--

Maybe you already did some more research and already found out more about how to run mod_php4 and mod_php5 together with one apache...

I'd be very glad If you could share your conclusions,
yours Henri
Back to top
View user's profile Send private message
simon pants
n00b
n00b


Joined: 30 Apr 2004
Posts: 47

PostPosted: Thu Dec 09, 2004 10:16 pm    Post subject: Reply with quote

Hi All,

Sorry for lack of support/chat/feedback. Been on holiday. Am scanning your feedback and embarking on some myself.

Thanks for your replies. Very cool.

Simon
Back to top
View user's profile Send private message
pstradomski
n00b
n00b


Joined: 15 Jan 2005
Posts: 27

PostPosted: Mon Jan 31, 2005 2:46 pm    Post subject: Reply with quote

I managed to install both versions of mod_php (not the php itself) with portage. First, I've installed mod_php5. Then I've edited the ebuild for mod_php-4.3.10 and changed the slot to "4_${APACHEVER}" and emerged it. Now I can choose which one i want to use by editing /etc/conf.d/apache2

Last edited by pstradomski on Mon Jan 31, 2005 8:53 pm; edited 1 time in total
Back to top
View user's profile Send private message
joefish
Guru
Guru


Joined: 27 Jan 2004
Posts: 316
Location: New Zealand

PostPosted: Mon Jan 31, 2005 8:42 pm    Post subject: Reply with quote

Nice.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum