[solved] PHP 5.2.X + PHP 5.3.X side-by-side on a LSWS+cPanel Server

MikeDVB

Well-Known Member
#1
Hello!

I know that it's possible to run PHP 5.3.X and 5.2.X side by side and I have a gist of how to get it done. We're already running 5.2.X on our servers.

I've guessed this so far:
  1. Build PHP 5.3.X manually, it will need it's own folder for the binaries, it's own php.ini, extension directories, modules, etc...
  2. Add a new LSAPI handler in LiteSpeed for the new PHP binary.
I also know about these two commands for the ./configure:
Code:
./configure --prefix=/wherever/php5.3 --with-config-file-path=/wherever/php5.3
I'm trying to work out if I need to do anything else special with the ./configure to install it separately.

Anybody have any thoughts/tips/suggestions on installing 5.3 on a server with 5.2 without conflicts? I'm going to get it working one way or another since I know it's possible and I'll test it on our dev box before putting it on a production server obviously.

Just thought, if anybody has "Been there, done that" then there would be no need to re-invent the wheel.
 
Last edited by a moderator:
#4
I am interested in doing this. Is this possible to do all form the admin panel is Cpanel. If so do you have any step by step directions?
 

webizen

Well-Known Member
#5
it is possible to do this by compiling PHP (not matching php) from from admin cp (cpanel -> plugins -> litespeed web server -> admin web console -> Actions -> Compile PHP). Once done, as described in http://www.litespeedtech.com/suppor...multiple_phps_in_control_panel_lsws#procedure, you need to
1. Create External App at server level to link to the PHP just built
2. Create Script Handler for each Ext App
3. Add MIME Type for corresponding handlers in vhost httpd.conf or user per directory .htaccess
 
#6
I have been working to get this working and all seems fine except for the add handler is not working. I have went through all the steps and this is what I have so far:


This shows that both the 5.2.17 and 5.3.8 versions are indeed compiled:
Code:
root@*****[/usr/local/lsws/fcgi-bin]# ls -l /usr/local/lsws/fcgi-bin
total 48792
drwxr-xr-x  2 root root     4096 Nov  2 20:35 ./
drwxr-xr-x 16 root root     4096 Nov  2 19:58 ../
-r-xr-xr-x  1 root root     3342 May  8 21:49 lsperld.fpl*
-r-xr-xr-x  1 root root  2280672 May  8 21:49 lsphp*
lrwxrwxrwx  1 root root        7 May  8 21:49 lsphp4 -> ./lsphp*
lrwxrwxrwx  1 root root       12 Nov  2 20:35 lsphp5 -> lsphp-5.2.17*
-rwxr-xr-x  1 root root 22225638 May  8 21:56 lsphp-5.2.17*
-rwxr-xr-x  1 root root 25361172 Nov  2 19:59 lsphp-5.3.8*
-r-xr-xr-x  1 root root     4691 Nov  2 19:44 RailsRunner.rb*
-r-xr-xr-x  1 root root     1095 Nov  2 19:44 RailsRunner.rb.2.3*

Added the External App for the 5.3 extension:
Code:
LSAPI App	lsphp53	uds://tmp/lshttpd/lsphp53.sock
Also added the Script Handler:
Code:
php53	LiteSpeed API	[Server Level]: lsphp53
I can also switch back and forth between the versions via ln -sf lsphp-5.2.17 lsphp5 and ln -sf lsphp-5.3.8 lsphp5, but if I add the handler in an accounts .htaccess file:

Code:
 AddHandler application/x-httpd-php53  .php
the phpinfo still show the version at 5.2.17. So I am a bit lost here. I am not entirely sure if this would show on the phpinfo or not, but I would think it would.

Is there any other way to verify this is working correctly? Any help would be appreciated.
 

mistwang

LiteSpeed Staff
#7
make sure lsphp53 external app is use lsws/fcgi-bin/lsphp-5.3.8

not lsws/fcgi-bin/lsphp5


enable debug logging and check detail log.
 
Top