How to install PHP 5.2 and 5.3 together

e-mike

Verified User
Joined
Jan 12, 2011
Messages
7
I've searched the forum and found info about installing PHP 5.2 and 5.3 together. What I miss is a simple guide how to establish this.

What I'm looking for is a simple guide how to install PHP 5.2 and PHP 5.3 together where PHP 5.2 is default and PHP 5.3 can be enabled through the following line:

Code:
# .htaccess

AddHandler application/x-httpd-php53 .php
  • PHP 5.2 (default)
  • PHP 5.3 (htaccess)

(Thus not with "x-httpd-php6" to fool DA that it's PHP 6 but it is PHP 5.3)

Has anyone the knowledge to establish this and make a simple guide? Martynas (smtalk) maybe?
 

smtalk

Administrator
Staff member
Joined
Aug 22, 2006
Messages
9,300
Location
LT, EU
Yes, it is possible to do that. Use the same guide and execute the following afterwards:
Code:
perl -pi -e 's/x-httpd-php6/x-httpd-php53/' /usr/local/suphp/etc/suphp.conf
perl -pi -e 's/x-httpd-php6/x-httpd-php53/' /etc/httpd/conf/extra/httpd-suphp.conf
That's it! Good luck :)
 

PRB

Verified User
Joined
Oct 18, 2008
Messages
162
So we should do the following commands to achieve this, is this correct?

cd /usr/local/directadmin/custombuild
./build set custombuild 1.2
./build update
mkdir -p custom/suphp
cp -pf configure/suphp/configure.php5 custom/suphp/configure.php6
perl -pi -e 's/php53/phprep/' versions.txt
perl -pi -e 's/php6/php53/' versions.txt
perl -pi -e 's/phprep/php6/' versions.txt
./build set php5_ver 5.2
./build set php6_cgi yes
./build set php5_cgi no
./build set php5_cli yes
#set php6-cgi (or cli) to yes in the options.conf
./build php n
mv -f /usr/local/php6 /usr/local/php6_old
ln -s /usr/local/php5 /usr/local/php6
perl -pi -e 's/x-httpd-php6/x-httpd-php53/' /usr/local/suphp/etc/suphp.conf
perl -pi -e 's/x-httpd-php6/x-httpd-php53/' /etc/httpd/conf/extra/httpd-suphp.conf
If so, does this only work with suPHP and thus not with php-cli?
 

smtalk

Administrator
Staff member
Joined
Aug 22, 2006
Messages
9,300
Location
LT, EU
Correct. If you'd like to have PHP 5.3 as mod_php (CLI) and PHP 5.2 as CGI (with suPHP), then it's very easy to do that too, you'd just need to modify a few steps.
 

e-mike

Verified User
Joined
Jan 12, 2011
Messages
7
smtalk, can you tell us what to do when updating DA?

Suppose you have 25+ servers and when you update DA, the change for PHP 5.3 next to 5.2 is undone with every update of DA. Is there a way to keep the extra config during update of DA automatically? You don't want to update every server by hand only for the second PHP support.

So basically my question is how to update DA with PHP 5.2 AND 5.3 automatically?
 

smtalk

Administrator
Staff member
Joined
Aug 22, 2006
Messages
9,300
Location
LT, EU
Execute the following:
Code:
cd /usr/local/directadmin/custombuild
./build update
perl -pi -e 's/php53/phprep/' versions.txt
perl -pi -e 's/php6/php53/' versions.txt
perl -pi -e 's/phprep/php6/' versions.txt
./build update_versions
perl -pi -e 's/x-httpd-php6/x-httpd-php53/' /usr/local/suphp/etc/suphp.conf
perl -pi -e 's/x-httpd-php6/x-httpd-php53/' /etc/httpd/conf/extra/httpd-suphp.conf
If you'd like to update everything and have PHP 5.2+5.3 left.
 

duke28

Verified User
Joined
Oct 30, 2005
Messages
303
Location
Montreal - Canada
i try to install

php4 cgi yes
php5 cgi yes
php6 cgi yes ( instructions for have php5.3 )

but its remove php4 cgi

normal ?

i need 3 php cgi
 

zyga2004

New member
Joined
Sep 5, 2011
Messages
2
i did that and when i swith for php5.3 i get internal error and i cant see my page

when i check the phpinfo in the base_dir is emty

can u help my with that

thenks
 

SeLLeRoNe

Super Moderator
Joined
Oct 9, 2004
Messages
6,797
Location
A Coruña, Spain
Actually im facing a problem.

version.txt is edited as described, but when i run build php n the script will donwload php 6... and version.txt go back to original...

Any workaround?

Regards
 

urbee

Verified User
Joined
Mar 27, 2009
Messages
124
Same here, custombuild downloads php6 and installs it. Followed your instructions, except using "php6" as cli and 5.2 as cgi.

SeLLeRoNe have u resolved this?
 

SeLLeRoNe

Super Moderator
Joined
Oct 9, 2004
Messages
6,797
Location
A Coruña, Spain
Nope i didnt, but ive gave customers a month of time for upgrade their websites and now ive moved to php 5.3

There should be something "different" in build script that prevent this work-around to work correctly.

Regards
 

urbee

Verified User
Joined
Mar 27, 2009
Messages
124
I think i found my issue.

smtalk's guide was for 5.3 being as cgi and 5.2 as cli. As my case was the other way around, this line was the issue:

cp -pf configure/suphp/configure.php5 custom/suphp/configure.php6

had to do

cp -pf configure/ap2/configure.php5 custom/ap2/configure.php6

Seems to download 5.3 now, but havent yet finished the configuration so cant confirm it works.
 

SeLLeRoNe

Super Moderator
Joined
Oct 9, 2004
Messages
6,797
Location
A Coruña, Spain
well my problem was in build file not in configuration... he was only downloading version 6 and never 5.2 with 5.3, so maybe you had a different issue i suppose...

Regards
 

smtalk

Administrator
Staff member
Joined
Aug 22, 2006
Messages
9,300
Location
LT, EU
I need to find some time to rewrite CustomBuild to allow using few versions of PHP 5.x on the same server. SeLLeRoNe, make sure autover=no is set in the options.conf file.
 

SeLLeRoNe

Super Moderator
Joined
Oct 9, 2004
Messages
6,797
Location
A Coruña, Spain
Well i dont need it anymore now, but thanks :)

yes it was on yes... should be nice to get this

Code:
./build set autover no
in installation instructions.

Regards and thanks
 
Top