Upgrading to PHP 5.x?

Discussion in 'Linux VPS - DirectAdmin' started by BAlGaInTl, Jul 16, 2007.

  1. BAlGaInTl

    BAlGaInTl New Member

    So, with many scripts stopping their support for PHP 4.x, it has been announced that PHP 4.x will no longer be supported after this year. The end of life announcement can be found at:

    http://www.php.net/

    So my question is this...

    Is there an easy way to update my VPS with DA to PHP 5.x?

    What do I stand to loose/break?
     
  2. Jleagle

    Jleagle New Member

  3. BAlGaInTl

    BAlGaInTl New Member

    Unfortuneately, that is is for cPanel/WHM.

    I'm using DirectAdmin (DA).

    Does KnownHost have a howto for that one? I haven't been able to find it yet.
     
  4. Jleagle

    Jleagle New Member

  5. BAlGaInTl

    BAlGaInTl New Member

    Thanks for the link.

    I actually found several different PHP upgrade options from DA. However, the variety makes me nervous... It seems that it is slightly different for every server. I'm still new to this type of admin coming from a reseller account.

    I was kind of hoping for a KH specific tutorial like the one for cPanel. I wish it were that easy for DA.
     
  6. VibrantStream.com

    VibrantStream.com New Member

    To update to php5, the build script will still work. All that you need to do is swap out the version, compile normally and make a few modifications to your /etc/httpd/conf/httpd.conf file.

    1) download the php-5.2.2.tar.gz from php.net into your customapache directory:
    Code:
    cd /usr/local/directadmin/customapache
    wget http://files.directadmin.com/services/customapache/php-5.2.2.tar.gz
    2) change your build script for the new version:
    Code:
    nano build
    change: PHP_VER=4.4.4
    to: PHP_VER=5.2.2

    3) build php normally:
    Code:
    ./build clean
    ./build php n
    If you're using apache 2.x, use
    Code:
    ./build clean
    ./build php_ap2 n
    instead.

    4) edit /etc/httpd/conf/httpd.conf
    Remove any referce of:
    Code:
    LoadModule php4_module        modules/libphp4.so
    and make sure they're replaced with:
    Code:
    LoadModule php5_module        modules/libphp5.so
    Remove any reference of:
    Code:
    AddModule mod_php4.c
    and replace with:
    Code:
    AddModule mod_php5.c
    5) find this piece of code:
    Code:
    <IfModule mod_dir.c>
        DirectoryIndex index.html index.htm index.shtml index.php index.php4 index.php3 index.phtml index.cgi
    </IfModule>
    replace with:
    Code:
    <IfModule mod_dir.c>
        DirectoryIndex index.html index.htm index.shtml index.php index.php4 index.php5 index.php3 index.phtml index.cgi
    </IfModule>
    Find this:
    Code:
    <IfModule mod_php4.c>
            AddType application/x-httpd-php .inc .php .php4 .php3 .phtml
            AddType application/x-httpd-php-source .phps
        </IfModule>
    (it might have AddHandler instead of AddType)
    replace with:
    Code:
    <IfModule mod_php5.c>
            AddHandler application/x-httpd-php .inc .php .php5 .php4 .php3 .phtml
            AddHandler application/x-httpd-php-source .phps
        </IfModule>
    Then restart apache.

    If you get the following error while compiling php:
    Code:
     checking whether to enable LIBXML support... yes
    checking libxml2 install dir... no
    checking for xml2-config path...
    configure: error: xml2-config not found. Please check your libxml2
    installation.
    
    *** There was an error while trying to configure php. Check the configure.php file
    Then edit the configure.php file (or configure.php_ap2 if you're using apache 2), and change:
    Code:
    --with-xml \
    to:
    Code:
            --disable-libxml \
            --disable-dom \
            --disable-xml \
            --disable-simplexml \
            --disable-xmlreader \
            --disable-xmlwriter \
    or else install the missing rpms/packages for xml. (libxml2-dev and libxml2-utils on debian). Redhats:
    Code:
    yum -y install libxml2-devel libxslt-devel
    FreeBSD:
    Code:
    pkg_add -r libxml2
    pkg_add -r libxslt
     
  7. BAlGaInTl

    BAlGaInTl New Member

    It appears that this has worked.

    I'm getting an error now that my version of Zend is not supported, so I have to figure that one out now.
     
  8. VibrantStream.com

    VibrantStream.com New Member

    To install Zend Optimizer:
    1. Login to your server via SSH
    2. Run: /scripts/installzendopt
    3. Follow the instructions on the screen to install Zend Optimizer



    This should work :]
     
  9. BAlGaInTl

    BAlGaInTl New Member

    I actually used the DA instructions I found and it is working fine:

    Code:
     cd /usr/local/directadmin/customapache
    ./build clean
    ./build update
    ./build zend
     
  10. BAlGaInTl

    BAlGaInTl New Member

    Perhaps this could be added to the DirectAdmin "How To" section?
     
  11. VibrantStream.com

    VibrantStream.com New Member

    I already added it :]
     
  12. BAlGaInTl

    BAlGaInTl New Member

    Well...

    There you go then.

    :)
     
  13. VibrantStream.com

    VibrantStream.com New Member

    Just to know,
    Did you fix your problem ?
     
  14. BAlGaInTl

    BAlGaInTl New Member

    Yes,

    Everything is operating smoothly.
     

Share This Page