SolarisLOAP

From SaWiki

Jump to: navigation, search

Install LDAP Oracle Apache PHP (LOAP) on Solaris 10

Menu: LinuxLOAP

Contents


Environment:
OS: SunOS infosecsol 5.10 Generic_118833-36 sun4u sparc SUNW,Ultra-60
Apache: 2.2.4, httpd-2.2.4.tar.gz
PHP: Version 5.2.3, php-5.2.3.tar
Oracle: 10.2.0.3
LDAP: openldap-stable-20070831.tgz
GCC: gcc (GCC) 3.3.2
PATH==/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/bin:/usr/local/BerkeleyDB.4.2:/usr/local/ssl/bin:
/usr/lib/oracle/10.2.0.3/client/bin:/export/home/gforrest/bin
CPPFLAGS="-I/usr/local/BerkeleyDB.4.2/include:/usr/local/ssl/include:/usr/include/oracle/10.2.0.3/client"
LDFLAGS="-L/usr/local/lib -L/usr/local/BerkeleyDB.4.2/lib -R/usr/local/BerkeleyDB.4.2/lib"
LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib:/usr/lib/oracle/10.2.0.3/client/lib:/usr/local/BerkeleyDB.4.2/lib:/usr/local/ssl/lib

Install Compiler for Solaris

Installed the following packages from the Solaris 10 Software Disc 3
SUNWbtool (ar)
SUNWsprot (make)
SUNWhea (stdio.h)
SUNWbinutils

SunFreeware

SMCautom automake-1.10-sol10-sparc-local
SMCautoc autoconf-2.60-sol10-sparc-local
SMCbinut binutils-2.17-sol10-sparc-local
SMCgcc	gcc-3.3.2-sol10-sparc-local
SMCbison bison-2.3-sol10-sparc-local
SMCflex flex-2.5.33-sol10-sparc-local
SMCindent indent-2.2.9-sol10-sparc-local
SMCiconv libiconv-1.11-sol10-sparc-local
SMCm4 m4-1.4.7-sol10-sparc-local
SMCmake make-3.81-sol10-sparc-local
SMCdb  db-4.2.52.NC-sol10-sparc-local (db.h)
SMCssl openssl-0.9.8f-sol10-sparc-local 
SMClxml2  libxml2-2.6.26-sol10-sparc-local (installs into /usr/local/lib include bin)
SMCzlib  zlib-1.2.3-sol10-sparc-local (installs into /usr/local/lib include bin)
  • removed SUNWgcc

Setup new gcc

$ sudo /usr/local/lib/gcc-lib/sparc-sun-solaris2.10/3.3.2/install-tools/mkheaders

Install Oracle Insta Client

Download the Basic client and the SDK from Oracle (32bit for Solaris -- PHP is 32bit) http://www.oracle.com/technology/tech/oci/instantclient/index.html

# unzip instantclient-basic-solaris6432-10.2.0.3-20070101.zip -d /usr/local
# cd /usr/local/instaclient_10_2
# mkdir -p /usr/lib/oracle/10.2.0.3/client/lib
# cp * /usr/lib/oracle/10.2.0.3/client
# cd /usr/lib/oracle/10.2.0.3/client
# ln -s libclntsh.so.10.1 libclntsh.so
# ln -s libocci.so.10.1 libocci.so
# unzip instantclient-sdk-solaris6432-10.2.0.3-20070101.zip -d /usr/local
# cd /usr/local/instaclient_10_2/sdk/include
# mkdir -p /usr/include/oracle/10.2.0.3/client
# cp * /usr/include/oracle/10.2.0.3/client
# unzip instantclient-sqlplus-solaris6432-10.2.0.3-20070101.zip -d /usr/local
# cd /usr/local/instaclient_10_2
# mkdir /usr/lib/oracle/10.2.0.3/client/bin
# cp sqlpus /usr/lib/oracle/10.2.0.3/client/bin/
# cp genezi /usr/lib/oracle/10.2.0.3/client/bin/


Setup LD_LIBRARY_PATH for Oracle

$ echo $LD_LIBRARY_PATH
/usr/local/lib:/usr/lib/oracle/10.2.0.3/client/lib

Install LDAP Client and Libraries

      • Need ar (SUNWbtool)
compile OpenLDAP from http://openldap.org
$ ./configure --prefix=/usr/local/openldap
$ make depend
$ sudo make install

Install apr & apr-util (with LDAP support)

*Needed if OS has older version of APR

apr setup

$ apr-1.2-11/configure --prefix=/usr/local/apr
$ make
$ sudo make install

apr-util

$ apr-util-1.2-10/configure --prefix=/usr/local/apr --with-ldap --with-ldap-include=/usr/local/openldap/include --with-ldap-lib=/usr/local/openldap/lib --with-apr=/usr/local/apr
$ make
$ sudo make install

Apache 2.2.4

$ ./configure --prefix=/usr/local/apache-2.2.4.loap --enable-ssl --with-ssl=/usr/local/ssl --enable-setenv\
--enable-so --enable-mods-shared=all --enable-ldap --enable-authnz_ldap --with-ldap --with-apr=/usr/local/apr\
--with-apr-util=/usr/local/apr
$ make
$ sudo make install

PHP 5.2.3

$ ./configure --enable-exif --enable-track-vars --with-calendar=shared --enable-magic-quotes\
--with-ldap=/usr/local/openldap --with-apxs2=/usr/local/apache-2.2.4.loap/bin/apxs \
--with-oci8=instantclient,/usr/lib/oracle/10.2.0.3/client/lib --with-openssl=/usr/local/ssl
$ make
$ make test
$ sudo su -
# source compile_profile
# sudo cp php.ini-recommended /usr/local/lib/php.ini

Note [PEAR] PEAR - installed: 1.5.4 Wrote PEAR system config file at: /usr/local/etc/pear.conf You may want to add: /usr/local/lib/php to your php.ini include_path Installing PDO headers: /usr/local/include/php/ext/pdo/

Notes

  • ERROR: ld: fatal: file /usr/lib/oracle/10.2.0.3/client/lib/libclntsh.so: wrong ELF class: ELFCLASS64

SOLUTION: Use 32bit Oracle Instaclient as PHP is only 32bit

ERROR: No recognized SSL/TLS toolkit detected Solution: Installed openssl and added to PATH and LD_LIBRARY_PATH and into configure string

ERROR: httpd: Syntax error on line 108 of /usr/local/apache-2.2.4.loap/conf/httpd.conf: Cannot load /usr/local/apache-2.2.4.loap/modules/libphp5.so into server: ld.so.1: httpd: fatal: libnnz10.so: open failed: No such file or directory Solution: libnnz10.so is an oracle library, check the PATH and LD_LIBRARY_PATH for the correct settings.

Solaris SMF Setup

  1. Create SMF method (http-apache2-loap) and manifest (http-apache2-loap.xml), examples below.
  2. Verify manifest syntax
# xmllint --valid http-apache2-loap.xml
  1. Import Manifest into SMF
# svccfg -v import /var/svc/manifest/network/http-apache2-loap.xml
  1. Enable Service
# svcadm -v enable apache2-2

Method: /lib/svc/method/http-apache2-loap


 #!/sbin/sh
 #
 # Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident "@(#)http-apache2-2     1.2     04/11/11 SMI"
 #

 . /lib/svc/share/smf_include.sh

 APACHE_HOME=/usr/local/apache
CONF_FILE=/usr/local/apache/conf/httpd.conf
PIDFILE=/usr/local/apache/log/httpd.pid

#Oracle Settings
LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.3/client/lib:${LD_LIBRARY_PATH}
TNS_ADMIN=/var/opt/oracle
export LD_LIBRARY_PATH TNS_ADMIN

[ ! -f ${CONF_FILE} ] &&  exit $SMF_EXIT_ERR_CONFIG

case "$1" in
start)
        /bin/rm -f ${PIDFILE}
        ssl=`svcprop -p httpd/ssl svc:/network/http:apache2-loap`
        if [ "$ssl" = false ]; then
                cmd="start"
        else
                cmd="startssl"
        fi
        ;;
refresh)
        cmd="graceful"
        ;;
stop)
        cmd="stop"
        ;;
*)
        echo "Usage: $0 {start|stop|refresh}"
        exit 1
        ;;
esac

exec ${APACHE_HOME}/bin/apachectl $cmd 2>&1

Manifest: /var/svc/manifest/network/http-apache2-loap.xml


<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
    Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
    Use is subject to license terms.

    ident       "@(#)http-apache2-2.xml 1.2     04/11/11 SMI"
-->

<service_bundle type='manifest' name='apache2-loap'>

<service
        name='network/http'
        type='service'
        version='1'>

        <!--
          Because we may have multiple instances of network/http
          provided by different implementations, we keep dependencies
          and methods within the instance.
        -->

        <instance name='apache2-loap' enabled='false'>
                <dependency name='loopback'
                    grouping='require_all'
                    restart_on='error'
                    type='service'>
                        <service_fmri value='svc:/network/loopback:default'/>
                </dependency>

                <dependency name='physical'
                    grouping='optional_all'
                    restart_on='error'
                    type='service'>
                        <service_fmri value='svc:/network/physical:default'/>
                </dependency>

                <exec_method
                        type='method'
                        name='start'
                        exec='/lib/svc/method/http-apache2-loap start'
                        timeout_seconds='60' />

                <exec_method
                        type='method'
                        name='stop'
                        exec='/lib/svc/method/http-apache2-loap stop'
                        timeout_seconds='60' />

                <exec_method
                        type='method'
                        name='refresh'
                        exec='/lib/svc/method/http-apache2-loap refresh'
                        timeout_seconds='60' />

                <property_group name='httpd' type='application'>
                        <stability value='Evolving' />
                        <propval name='ssl' type='boolean' value='false' />
                </property_group>

                <property_group name='startd' type='framework'>
                        <!-- sub-process core dumps shouldn't restart
                                session -->
                        <propval name='ignore_error' type='astring'
                                value='core,signal' />
                </property_group>

        </instance>

        <stability value='Evolving' />

        <template>
                <common_name>
                        <loctext xml:lang='C'>
                                Apache 2.2 HTTP server
                        </loctext>
                </common_name>
                <documentation>
                        <manpage title='apache2.2' section='1M' />
                        <doc_link name='apache.org'
                                uri='http://httpd.apache.org' />
                </documentation>
        </template>
</service>

</service_bundle>
Personal tools