PDA

View Full Version : How to install PHP 5.2 and 5.3 together



e-mike
01-14-2011, 05:04 AM
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:



# .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?

e-mike
01-14-2011, 05:16 AM
FYI This topic is about the PHP 6 trick to enable PHP 5.3 next to PHP 5.2 (http://www.directadmin.com/forum/showthread.php?t=35175&mode=linear)

smtalk
01-24-2011, 02:46 AM
Yes, it is possible to do that. Use the same guide and execute the following afterwards:


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
01-24-2011, 01:37 PM
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
01-25-2011, 03:34 AM
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
01-25-2011, 06:12 AM
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
01-25-2011, 06:43 AM
Execute the following:


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
06-14-2011, 07:13 PM
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

scsi
06-14-2011, 08:11 PM
Php 4 is eol you shouldnt be installing it.

zyga2004
09-05-2011, 05:56 AM
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
09-06-2011, 03:37 AM
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
11-04-2011, 03:55 PM
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
11-04-2011, 04:03 PM
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
11-04-2011, 04:08 PM
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
11-05-2011, 02:08 AM
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
11-05-2011, 09:22 AM
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
11-05-2011, 10:19 AM
Well i dont need it anymore now, but thanks :)

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


./build set autover no

in installation instructions.

Regards and thanks

zEitEr
11-08-2011, 02:13 AM
I need to find some time to rewrite CustomBuild to allow using few versions of PHP 5.x on the same server.


That would be really great.

tristan
11-08-2011, 12:05 PM
Wondering if Smtalk ever implemented that option now, would be nice to have indeed!

scsi
11-08-2011, 12:17 PM
why does it matter when 5.2 is eol

zEitEr
11-09-2011, 02:12 AM
I hope, 5.x does not limit only with 5.2.x and 5.3.x. As 5.4.x is coming soon. Of course this feature will be useful not for all. Otherwise it would be already implemented.

NoBaloney2
11-14-2011, 10:45 AM
why does it matter when 5.2 is eol
Perhaps because you may need it to keep one or more clients happy rather than lose them, when they require 5.2. I'm not saying this is a good idea, only that it may end up being a business decision.

Jeff

urbee
11-16-2011, 03:59 PM
Ok i'm having soo much issues with this.

I've got php 5.3.8 set as cli and 5.2.x as cgi (suphp). When i try to use 5.3 i get

"Warning: Unknown: open_basedir restriction in effect. File(/home/user/domains/domain.com/public_html/index.php) is not within the allowed path(s): (đ‡) in Unknown on line 0"

But open_basedir is not enabled anywhere and i cannot disable it!

Any ideas?

zEitEr
11-16-2011, 07:07 PM
And what about


# cat /usr/local/directadmin/data/users/<user>/httpd.conf

and


# cat /usr/local/directadmin/data/templates/custom/virtual_host2.conf

???

urbee
11-17-2011, 12:29 AM
No custom vhost exists, and the httpd.conf from the user folder doesnt make any difference. I tried disabling open_basedir inthere but does not help!

It would be awsome as hell if smtalk made a script to configure this automaticly cause i believe i did something wrong :p

zEitEr
11-17-2011, 12:34 AM
PM me if you want me to look at your server. I'll give you as low price as it is possible.

urbee
11-17-2011, 12:54 AM
Funny thing also:

php -i |grep open_basedir
open_basedir => no value => no value

smtalk
11-29-2011, 01:28 PM
I hope, 5.x does not limit only with 5.2.x and 5.3.x. As 5.4.x is coming soon. Of course this feature will be useful not for all. Otherwise it would be already implemented.

You will have an ability to use any combination :) Even PHP 6.0 (if it will be allowed in the options.conf). We already have CustomBuild 2.0-alpha coded :) The final version of it should be released in December.

smtalk
11-29-2011, 01:30 PM
Funny thing also:

php -i |grep open_basedir
open_basedir => no value => no value

Why is it funny? By default, open_basedir is not set in PHP configuration file (php.ini).

zEitEr
01-10-2012, 12:16 AM
Why is it funny? By default, open_basedir is not set in PHP configuration file (php.ini).

But why? It seems open_basedir is not depreciated in 5.3.x

mmx
01-12-2012, 04:51 PM
I've been wondering about the following scenarios (5.2/5.3):


CGI/CGI: can 5.2 and 5.3 both work as CGI? Can custombuild 1.2 handle this type of installation?
CGI/CLI: if I go this route, which has been documented pretty well in this thread, will 5.3 CLI be able to function safely without chown'ing users' files back to owner:apache?
CGI/FPM: is this possible to implement?

zEitEr
01-13-2012, 09:23 AM
CGI/CGI: can 5.2 and 5.3 both work as CGI?

Yes


Can custombuild 1.2 handle this type of installation?

No


CGI/CLI: if I go this route, which has been documented pretty well in this thread, will 5.3 CLI be able to function safely without chown'ing users' files back to owner:apache?

I'm not sure, I understand you right here.


CGI/FPM: is this possible to implement?

It seems to be possible.

stars
01-18-2012, 01:03 AM
I got problem with this - I wanted 5.2 as cgi suphp and 5.3 as cli so I ran:


cd /usr/local/directadmin/custombuild
./build set custombuild 1.2
./build update
cp -pf configure/ap2/configure.php5 custom/ap2/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 no
./build set php6_cli yes
./build set php5_cgi yes
./build set php5_cli no
./build php n

but when I ran:


mv -f /usr/local/php6 /usr/local/php6_old
ln -s /usr/local/php5 /usr/local/php6

I got error: "no such file or directory", and also my apache don't start throwing:


Starting httpd: httpd:
Syntax error on line 18 of /etc/httpd/conf/httpd.conf:
Syntax error on line 1 of /etc/httpd/conf/extra/httpd-phpmodules.conf:
Cannot load /usr/lib/apache/libphp6.so into server: /usr/lib/apache/libphp6.so:
cannot open shared object file: No such file or directory

Ankh_
02-07-2012, 03:14 AM
Same problem here:

mv: cannot stat `/usr/local/php6': No such file or directory

This should be right:

[root@zeus custombuild]# php -v
PHP 5.2.17 (cli) (built: Feb 7 2012 12:03:42)

Ankh_
02-07-2012, 04:00 AM
Also is it possible to run 5.2 and 5.3 as cgi together?

zEitEr
02-07-2012, 11:33 PM
Also is it possible to run 5.2 and 5.3 as cgi together?

Yes, why not? It was already discussed here (If I'm not mistaken).