could I install multiple version copy of php ?

adrianmak

Verified User
Joined
Jan 30, 2010
Messages
49
say 5.2.x, 5.3.x coexist on the server and add some user specific apache directive when creating a new web hosting user ?
 
You CAN have PHP 5.2 and 5.3 on the system. This trick will work with CustomBuild 1.2 (PHP5.2 as CLI and 5.3 as CGI (suPHP)):
Code:
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
Now PHP 5.3 will be installed as PHP6 in configuration files :)
 
Last edited:
You miss-spelled "versios.txt"

Anyways its good to know that this is possible.
 
Is it working for anyone? I'm trying my dev server with no success so far...

--edit
I think I've resolved it - autover must be set to no.
 
Last edited:
Would it be so hard to implement php 5.3 as separate php option?
 
error while trying to configure php

You CAN have PHP 5.2 and 5.3 on the system. This trick will work with CustomBuild 1.2:
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 set php5_ver 5.2
#set php6-cgi (or cli) to yes in the options.conf
./build php n
Now PHP 5.3 will be installed as PHP6 in configuration files :)

smtalk, I tried to follow your directions, but got the following:

Code:
*** There was an error while trying to configure php. Check the custom/suphp/configure.php6 file

Maybe this is not the preferred way to have both PHP 5.2.x and PHP 5.3.x both available, with DirectAdmin. ...I thought I had seen another thread on this subject and it even mentioned designating the php version per hosting account. I couldn't find that thread again though; I will keep searching.

I do need to have some of the hosting accounts on 5.2.14, while having others on 5.3.3.

Thanks for your help everyone.
 
I have SuPHP with PHP4 and PHP5.2.x
I try to install PHP4 and PHP5.2.x and PHP5.3.x
Now i can only install 2 versions PHP (PHP4 & PHP5.2.x) and (PHP5.2.x & PHP5.3.x)
Is it posible to install 3 versions?
In Custombuild 1.2 i can't install PHP4
 
This method won't work when using mod_php for both versions. "./build php n" just compiles the default version.

It would be great if there could be a way to install both php 5.2 and 5.3 at the same time.
It would allow admins to gradually shift sites from one version to another.
 
Seems the script can't find php.ini-dist
Code:
Make Complete
Copying php.ini..
cp: php.ini-dist: No such file or directory
 
Yes, because it does not exist. Feel free to copy your current one, if you want:
Code:
cp -p /usr/local/lib/php.ini /usr/local/etc/php6/cgi/php.ini
 
Yep, I was just mentioning because the script doesn't find it automatically, probably because the path is different between PHP 6 and 5.3.

So, it's not required to compile suPHP or modify the configure script for Apache?
We can just use:

Code:
<FilesMatch "\.php$">
AddHandler x-httpd-php6 .php
</FilesMatch>
in a vhost?
 
Yep, I was just mentioning because the script doesn't find it automatically, probably because the path is different between PHP 6 and 5.3.

So, it's not required to compile suPHP or modify the configure script for Apache?
We can just use:

Code:
<FilesMatch "\.php$">
AddHandler x-httpd-php6 .php
</FilesMatch>
in a vhost?

Yes, that code is enough in .htaccess to switch to PHP 5.3. Good luck!
 
Doesn't work for me. It seems, the php executable is not found. I get the source code instead of the result.

# ls /usr/local/php6/bin
total 7062
-rwxr-xr-x 1 root wheel 11M Jan 3 09:54 php
-rwxr-xr-x 1 root wheel 4.4K Jan 3 09:54 phpize
-rwxr-xr-x 1 root wheel 3.5K Jan 3 09:54 php-config
-rwxr-xr-x 1 root wheel 14K Jan 3 09:54 phar.phar
lrwxr-xr-x 1 root wheel 29B Jan 3 09:54 phar -> /usr/local/php5/bin/phar.phar
drwxr-xr-x 2 root wheel 7B Jan 3 09:54 .
drwxr-xr-x 9 root wheel 10B Jan 3 09:54 ..

Is there a path somewhere that needs to be changed?
 
Do you get no error? Try "./build rewrite_confs".
I'm either missing an "Action" or it's pointing to the wrong file since I don't have php-cgi, but couldn't quickly find which file was supposed to define that, so I'm going the FastCGI route. Seems easier.

I can't rewrite configs like that as I have some custom settings (Ruby, etc.)
 
And some thoughts on the current steps.
In order to match the current CLI config, I think it would be best to do this:
cp -pf custom/ap2/configure.php5 custom/suphp/configure.php6
and then to remove
--with-apxs2 \
and to add this at the top
--prefix=/usr/local/php5 \
--enable-force-cgi-redirect \
--enable-fpm \
--disable-cli \
--with-config-file-path=/usr/local/etc/php5/cgi \
and to modify the path to pear
--with-pear=/usr/local/php5/lib/php \

Also, with the current versions.txt manipulation, you'll only install php 5.3.4 every second try. In my script I'm making a backup of versions.txt first and I simply replace the modified one once php is compiled.
 
Quick update to let you know that it works very well with FastCGI/PHP-FPM.
The only issue is with extension. It's not as easy to install as when you just have one version of php installed...
 
You CAN have PHP 5.2 and 5.3 on the system. This trick will work with CustomBuild 1.2 (PHP5.2 as CLI and 5.3 as CGI (suPHP)):
Code:
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
Now PHP 5.3 will be installed as PHP6 in configuration files :)

I am getting the following error messsage

*** There was an error while trying to configure php. Check the custom/suphp/configure.php6 file
 
Back
Top