LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > PHP > [Resolved] One VH with Different PHP Version

Reply
 
Thread Tools Display Modes
  #1  
Old 05-04-2010, 09:32 AM
J.T. J.T. is offline
Member
 
Join Date: Apr 2010
Posts: 47
Question [Resolved] One VH with Different PHP Version

Hi,

I'm looking at ways to accomplish the following.

For one bit of PHP software I'd like to run 5.2.13. For another script I'd like to go with 5.3.latest

Right now they are both on the same domain, hence on the same virtualhost. I can split them by virtualhost if this makes it easier.

I just went through the server settings, as well as the VH settings but can't figure this out.

After compiling multiple PHP versions (so far I've just done 5.2.13) how do we specify which virtualhost uses which PHP version? Taking that further, how do we tell which directory is to be processed by which PHP version?

Hope you can point me in the right direction, thanks!

Last edited by NiteWave; 05-06-2010 at 06:44 PM..
Reply With Quote
  #2  
Old 05-04-2010, 12:27 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
Are you using LSWS with Apache httpd.conf or just configure everything natively from LSWS web console?
Basically, you assign PHP version with MIME type
application/x-httpd-php4 , application/x-httpd-php5 , etc.
Those MIME types are added by LSWS with you define a script handler for suffix php4 or php5. If you add a script handler for suffix "php53", then MIME type
application/x-httpd-php53 will be added.
Then you can change PHP version with Apache style configuration like

AddType application/x-httpd-php53 php

to use PHP 5.3 for file with suffix ".php".
It can be done in .htaccess or in LSWS configuration.
Reply With Quote
  #3  
Old 05-05-2010, 05:21 AM
J.T. J.T. is offline
Member
 
Join Date: Apr 2010
Posts: 47
It's a clean LSWS install, configured through admin console so no Apache relation any more.

I guess the sequence then is as follows.

1. Compile PHP 5.2.13 for example as LSPHP5213 with path /opt/lsws/lsphp5213
2. Compile PHP 5.3.2 for example as LSPHP532 with path /opt/lsws/lsphp532
3. Under Configuration > Virtual Hosts I edit VH "A", add a Script Handler, handler type Litespeed API and then the new drop-down will show lsphp5213 and lsphp532, pick one of those and then in suffixes, I just put .php so I don't have to rename all extensions.
4. Repeat 3 for VH "B"

Doing that per VH overrides the Server Wide script handler settings, which defaults to lsphp5.

Is that correct? I don't want to change all the .php to .php53 so I guess the above does it VH-wide, correct?
Reply With Quote
  #4  
Old 05-05-2010, 05:34 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
Yes, if you want to change PHP version VH-wide, you can do that.
If you only change it for certain PHP script, you need to play with the MIME types.
Reply With Quote
  #5  
Old 05-05-2010, 06:35 AM
J.T. J.T. is offline
Member
 
Join Date: Apr 2010
Posts: 47
That's fantastic, thanks.

Do you think we can actually save resources/CPU cycles etc. this way?

Say VH "A" is for a domain that is used 50% of all requests and it doesn't need any extra PHP extensions, and then VH "B" gets the other 50% of requests and does need a fair number of extensions. By compiling "dedicated" PHP environments for each, do we add overhead (two sets of PHP running) or actually save resources (half the requests aren't weighed down by unneeded extensions)?

Last edited by J.T.; 05-05-2010 at 06:37 AM..
Reply With Quote
  #6  
Old 05-05-2010, 09:11 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
It does not save resources, but provide some kind of isolation, one vhost does not affect another one.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:06 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.