• January 16th, 2010 @ 8:25 PM by Jean-Francois LEBON | Be the 1st to comment

    Recently, I successfully compiled Apache and Php to use a Sybase ASE v15.0.3 dataserver on CentOS v5.4 (32 bits). Apache was compiled with DSO support to use Php as a dynamically loadable module. This is how I did it:

    1°) Linux Requirements:

    You’ll need to download the Apache 2.0.63 and Php 5.3.1 sources.
    To compile Php and Apache, the following packages need to be installed:

    - make
    - automake
    - autoconf
    - libtool
    - makeinfo
    - bison
    - gcc
    - cpp
    - glibc-devel
    - perl

    Note:
    I assume in this tutorial Sybase ASE v15 has been already installed (up and running) on your Linux box.

    2°) Pre-Installation tasks:

    Note:
    I assume in this tutorial Sybase ASE v15 has been already installed (up and running) on your Linux box.

    Now we gonna set up the environment variables. Go to the directory where Sybase ASE is installed, and source the script named “ASE150.sh”:

    cd /usr/local/sybase/ase/1503
    . ./ASE150.sh
    

    Check your environment variables are set up correctly:

    env|grep -i syb
    

    Mines look like this:

    SYBASE_JRE6_32=/usr/local/sybase/ase/1503/shared/JRE-6_0_6_32BIT
    SYBASE_JRE6=/usr/local/sybase/ase/1503/shared/JRE-6_0_6_32BIT
    SYBASE_UA=/usr/local/sybase/ase/1503/UAF-2_0
    SYBASE_OCS=OCS-15_0
    SYBROOT=/usr/local/sybase/ase/1503
    SYBASE=/usr/local/sybase/ase/1503
    SYBASE_WS=WS-15_0
    SYBASE_ASE=ASE-15_0
    LD_LIBRARY_PATH=/usr/local/sybase/ase/1503/DataAccess/ODBC/lib:/usr/local/sybase/ase/1503/OCS-15_0/lib:/usr/local/sybase/ase/1503/OCS-15_0/lib3p:/usr/local/sybase/ase/1503/ASE-15_0/lib:
    PATH=/usr/local/sybase/ase/1503/ASE-15_0/jobscheduler/bin:/usr/local/sybase/ase/1503/RPL-15_0/bin:/usr/local/sybase/ase/1503/ASEP/bin:/usr/local/sybase/ase/1503/DBISQL/bin:/usr/local/sybase/ase/1503/UAF-2_0/bin:/usr/local/sybase/ase/1503/OCS-15_0/bin:/usr/local/sybase/ase/1503/ASE-15_0/bin:/usr/local/sybase/ase/1503/ASE-15_0/install:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

    Modify LD_LIBRARY_PATH and PATH as follow:

    export LD_LIBRARY_PATH=/usr/local/sybase/ase/1503/OCS-15_0:\
    /usr/local/sybase/ase/1503/OCS-15_0/include:/usr/include:\
    $LD_LIBRARY_PATH
    
    export PATH=/usr/local/sybase/ase/1503/OCS-15_0:\
    /usr/local/sybase/ase/1503/OCS-15_0/include:\
    /usr/include:$PATH
    

    Sybase changed open-client libraries names with Sybase ASE v15.
    Because Php 5.3.1 will look for Sybase ASE open-client libraries from Sybase ASE v12.x, you need to trick Php and create symbolic links in $SYBASE/$SYBASE_OCS/lib for each following libraries:

    lrwxrwxrwx 1 root root 13 Jan 12 01:32 libcobct.a -> libsybcobct.a
    lrwxrwxrwx 1 root root 15 Jan 12 01:31 libcobct_r.a -> libsybcobct_r.a
    lrwxrwxrwx 1 root root 16 Jan 12 01:33 libcobct_r.so -> libsybcobct_r.so
    lrwxrwxrwx 1 root root 14 Jan 12 01:32 libcobct.so -> libsybcobct.so
    lrwxrwxrwx 1 root root 12 Jan 12 01:29 libcomn.a -> libsybcomn.a
    lrwxrwxrwx 1 root root 14 Jan 12 01:29 libcomn_r.a -> libsybcomn_r.a
    lrwxrwxrwx 1 root root 15 Jan 12 01:29 libcomn_r.so -> libsybcomn_r.so
    lrwxrwxrwx 1 root root 13 Jan 12 01:30 libcomn.so -> libsybcomn.so
    lrwxrwxrwx 1 root root 10 Jan 12 01:34 libcs.a -> libsybcs.a
    lrwxrwxrwx 1 root root 12 Jan 12 01:34 libcs_r.a -> libsybcs_r.a
    lrwxrwxrwx 1 root root 13 Jan 12 01:34 libcs_r.so -> libsybcs_r.so
    lrwxrwxrwx 1 root root 11 Jan 12 01:34 libcs.so -> libsybcs.so
    lrwxrwxrwx 1 root root 10 Jan 12 01:32 libct.a -> libsybct.a
    lrwxrwxrwx 1 root root 12 Jan 12 01:31 libct_r.a -> libsybct_r.a
    lrwxrwxrwx 1 root root 13 Jan 12 01:32 libct_r.so -> libsybct_r.so
    lrwxrwxrwx 1 root root 11 Jan 12 01:31 libct.so -> libsybct.so
    lrwxrwxrwx 1 root root 12 Jan 12 01:14 libintl.a -> libsybintl.a
    lrwxrwxrwx 1 root root 14 Jan 12 01:15 libintl_r.a -> libsybintl_r.a
    lrwxrwxrwx 1 root root 15 Jan 12 01:15 libintl_r.so -> libsybintl_r.so
    lrwxrwxrwx 1 root root 13 Jan 12 01:15 libintl.so -> libsybintl.so

    Now you can start to compile Apache and Php with Sybase ASE v15.

    3°) Apache compilation:

    The Apache web server source code can be downloaded from http://httpd.apache.org.

    ./configure --prefix=/usr/local/httpd/apache/2063 \
    --enable-so
    make
    make install
    

    You must set the $SYBASE environment variable in the user’s profile who start Apache (in my case root) otherwise Php will not be able to connect to Sybase ASE. You can add $SYBASE in .bashrc or .profile or even Apache startup script:

    export SYBASE=/usr/local/sybase/ase/1503
    

    4°) Php compilation:

    The PHP source code can be downloaded from http://php.net.

    ./configure --prefix=/usr/local/php/531 \
    --with-apxs2=/usr/local/httpd/apache/2063/bin/apxs \
    --with-sybase-ct=/usr/local/sybase/ase/1503/OCS-15_0 \
    --with-config-file-path=/etc
    make
    make install
    

    Enjoy ;-)


    Tags: , , , , ,

    Bookmark this on Delicious
    Digg This
    Reddit This
    Bookmark this on Technorati
    Share on Facebook
    Buzz This
    Stumble Now!
    Share on LinkedIn
    Post on Twitter
  • No Comments »

    No comments yet.

    RSS feed for comments. TrackBack URL

    Something to say ? Leave a comment...

    You must be logged in to post a comment.