UPDATING to PHP 5.x

Discussion in 'DirectAdmin HOWTOs and Tutorials' started by VibrantStream.com, Aug 3, 2007.

  1. VibrantStream.com

    VibrantStream.com New Member

    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
    [/quote]
     
  2. onelove

    onelove New Member

    Well written "How to". Thank you.
     
  3. genroxbro

    genroxbro Guest

    UPDATING to PHP 5 x

    Well unless you have some extra line breaks, I see the errors as being on lines 8, 9 and 10, but the headers I count as being 6, 7 and 8.Any chance of you putting HTML tags before that PHP script? :/ Let me introduce myself.
     
  4. chrisd

    chrisd New Member

    This information looks to be obsolete so I figured I'd post an update. There's a newer tool called custombuild that seems to be the preferred way of updating software on a DirectAdmin VPS. Here's the FAQ/instructions page from the DA forums:

    [http] directadmin.com/forum/showthread.php?t=29824

    The custombuild tool itself can be downloaded from here: (this link is also referenced above)

    [http] files.directadmin.com/services/custombuild/1.1/

    I used custombuild to upgrade Apache to 2.2 and PHP to 5.2 on my KnownHost VPS account. Because this whole process seems clumsy and risk-prone, I edited options.conf (you'll see it mentioned in the FAQ above) to disable all other software updates aside from Apache and PHP.

    [Because I'm a new user, the forum helpfully won't allow me to post clickable links. You will need to copy and paste the ones above.]
     

Share This Page