Page 1 of 3 123 LastLast
Results 1 to 20 of 54

Thread: could I install multiple version copy of php ?

  1. #1
    Join Date
    Jan 2010
    Posts
    48

    could I install multiple version copy of php ?

    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 ?

  2. #2
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    6,744
    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 by smtalk; 12-30-2010 at 11:03 AM. Reason: Updated the guide
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  3. #3
    Join Date
    Aug 2008
    Posts
    4,697
    You miss-spelled "versios.txt"

    Anyways its good to know that this is possible.

  4. #4
    Join Date
    Sep 2009
    Posts
    55
    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 by meto; 02-28-2010 at 01:18 PM.

  5. #5
    Join Date
    Sep 2009
    Posts
    55
    Would it be so hard to implement php 5.3 as separate php option?

  6. #6
    Join Date
    Sep 2009
    Posts
    55
    I've got one problem. I have php5.2 and 5.3 installed as CGI and php5.2 as default. The problem is that PHP5.3 loads php.ini from php5.2 directory (as shown on the picture).
    http://img641.imageshack.us/img641/3547/php53.jpg

  7. #7
    Join Date
    Dec 2009
    Posts
    49

    Question error while trying to configure php

    Quote Originally Posted by smtalk View Post
    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.

  8. #8
    Join Date
    May 2008
    Posts
    24
    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

  9. #9
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    2,097
    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.
    Olivier
    interfaCentre - We design custom hosting solutions

    Custom apps, scripts and configurations for easy and secure access to all hosting services
    Full Personal Information Management suite with mobile synchronisation
    PHP, Ruby, Node.js and Python hosting with 1-click app install

  10. #10
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    6,744
    I updated my guide, a few details were missing.
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  11. #11
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    2,097
    Seems the script can't find php.ini-dist
    Code:
    Make Complete
    Copying php.ini..
    cp: php.ini-dist: No such file or directory
    Olivier
    interfaCentre - We design custom hosting solutions

    Custom apps, scripts and configurations for easy and secure access to all hosting services
    Full Personal Information Management suite with mobile synchronisation
    PHP, Ruby, Node.js and Python hosting with 1-click app install

  12. #12
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    6,744
    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
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  13. #13
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    2,097
    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?
    Olivier
    interfaCentre - We design custom hosting solutions

    Custom apps, scripts and configurations for easy and secure access to all hosting services
    Full Personal Information Management suite with mobile synchronisation
    PHP, Ruby, Node.js and Python hosting with 1-click app install

  14. #14
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    6,744
    Quote Originally Posted by interfasys View Post
    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!
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  15. #15
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    2,097
    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?
    Olivier
    interfaCentre - We design custom hosting solutions

    Custom apps, scripts and configurations for easy and secure access to all hosting services
    Full Personal Information Management suite with mobile synchronisation
    PHP, Ruby, Node.js and Python hosting with 1-click app install

  16. #16
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    6,744
    Do you get no error? Try "./build rewrite_confs".
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  17. #17
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    2,097
    Quote Originally Posted by smtalk View Post
    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.)
    Olivier
    interfaCentre - We design custom hosting solutions

    Custom apps, scripts and configurations for easy and secure access to all hosting services
    Full Personal Information Management suite with mobile synchronisation
    PHP, Ruby, Node.js and Python hosting with 1-click app install

  18. #18
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    2,097
    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.
    Olivier
    interfaCentre - We design custom hosting solutions

    Custom apps, scripts and configurations for easy and secure access to all hosting services
    Full Personal Information Management suite with mobile synchronisation
    PHP, Ruby, Node.js and Python hosting with 1-click app install

  19. #19
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    2,097
    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...
    Olivier
    interfaCentre - We design custom hosting solutions

    Custom apps, scripts and configurations for easy and secure access to all hosting services
    Full Personal Information Management suite with mobile synchronisation
    PHP, Ruby, Node.js and Python hosting with 1-click app install

  20. #20
    Join Date
    Apr 2007
    Posts
    243
    Quote Originally Posted by smtalk View Post
    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

Page 1 of 3 123 LastLast

Similar Threads

  1. need advice on multiple php version best practices
    By dmacleo in forum General Technical Discussion & Troubleshooting
    Replies: 0
    Last Post: 07-25-2012, 03:05 PM
  2. install php previous version from ports
    By tsiou in forum FreeBSD
    Replies: 0
    Last Post: 10-05-2010, 11:56 PM
  3. Version 1.1.3 Jail install error
    By iceuk626 in forum CustomBuild
    Replies: 12
    Last Post: 04-02-2009, 01:33 AM
  4. FreeBSD MySQL - how to install ports version
    By floris in forum MySQL / PHP
    Replies: 0
    Last Post: 07-11-2006, 05:31 AM
  5. How do I install multiple SSl certs in the same DA account?
    By mrzippy in forum User-Level Difficulties
    Replies: 3
    Last Post: 08-29-2004, 09:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •