Recent Changes - Search:


Code:


Social:


My journals will take the place of a blog. If you go to the Journal page there is an RSS feed to subscribe with.

« September 2017 
SunMonTueWedThuFriSat
     12
3456789
10111213141516
17181920212223
24252627282930

Sites I take responsibility for

West Volusia, Florida

Documents

Technical

General

Me

Living

Places I frequent

Hobbies

Humor

Items for sale:


Clipboard

edit SideBar

Compiling PHP 4.4.8 And Freetds On Solaris 10

Include our styles below Infobox - invoke as >>infobox<< ... >><<

Codebox: - invoke as >>codebox<< ... >><<

warnbox: - invoke as >>codebox<< ... >><<

editingbox: - invoke as >>codebox<< ... >><<

noticebox: - invoke as >>codebox<< ... >><<

Page bread crumbs: Welcome to ke3vin.org! - Compiling PHP And Freetds On Solaris 10

Pages by tags: (:listtags:)
Subscribe to this wiki: RSS Feed RSS or subscribe to this page for changes: RSS Feed RSS
496 articles have been published so far. Recent changes
Share

2016-03-22: This site is being moved to my main site at https://kevininscoe.com/wiki as part of a consolidation to one domain.


Back to Howtos?

Notes:

http://www.kevininscoe.com/geek/sun/compilesun/

Prerequisites:

Solaris 9 and later comes with an entropy device. /dev/random

gcc 3.4.6 and GNU make 3.81 installed from http://www.sunfreeware.com

Also assumes Apache 2.2.9 has been compiled or installed and supports using apxs. Tailor the configure lines in PHP below to match the directory where Apache is installed in.

Download and install:

ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/gcc-3.4.6-sol10-sparc-local.gz

The GNU C compiler and related programs - installs in /usr/local. This package includes the GNU C, C++, and f77 suites and support files. These gcc packages require the installation of libiconv. It was compiled to use the SUN assembler and loader usually in /usr/ccs/bin if the SUNW developer packages are installed. When needed and the source code supports it, this C compiler can create 64-bit executables via the -m64 flag as well as the usual 32-bit ones. Please read the details on how this package was created which can be found at Comments on gcc 3.4.6 . The Details link below contains information on what is new in 3.4.6. Documentation is in /usr/local/doc/gcc, /usr/local/man, and /usr/local/info. The gcc package is quite large. Some users may have trouble downloading very large files via a browser. These users should try using command line anonymous ftp or perhaps the Sun Download Manager.

Make:

The GNU version of make, also known as gmake - installs in /usr/local. Dependencies: To have /usr/local/lib/libgcc_s.so.1 install either the libgcc-3.4.6 or gcc-3.4.6 or higher packages.

ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/make-3.81-sol10-sparc-local.gz

Testing that our installed products work:

 # gcc -v
 Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.6/specs
 Configured with: ../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --enable-shared --enable-languages=c,c++,f77
 Thread model: posix
 gcc version 3.4.6

 # make -v
 GNU Make 3.81
 Copyright (C) 2006  Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.
 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
 PARTICULAR PURPOSE.

 This program built for sparc-sun-solaris2.10

Prep and Environment:

Create our source workbench:

 # mkdir /build

Everything we compile here will get un-tarred into /build using it's original directory name in the tar file or archive.

First note where Apache is built (it is assumed Apache 2.2.x is already built and is not covered by this procedure) and modify these procedures below to use the correct path name. Apache is usually built out of the /local directory by site name.

Environment:

We need to create our environment variables file: /build/setup.sh. This procedure is assuming you are using ksh as delivered from Sun. If not you will need to modify the variables to work with your shell. Create /build/setup.sh to look like this ans then switch to the Sun ksh for the rest of the build.

 #!/bin/ksh 

 LD_LIBRARY_PATH=/usr/local/openssl/lib/:/usr/local/lib:/usr/lib:/lib; export  LD_LIBRARY_PATH 
 PATH=/usr/local/bin:/usr/bin:/etc:/opt/EMCpower/bin/64:/etc/emc/bin; export PATH

 # Non-shared
 CFLAGS="-m32 -mcpu=v9 -O2 -fno-exceptions"; export CFLAGS 
 CXXFLAGS="-m32 -mcpu=v9 -O2 -felide-constructors -fno-rtti"; export CXXFLAGS 

 LDFLAGS="-m32 -mcpu=v9"; export LDFLAGS

Now to load these environment variables into your shell from ksh:

 # . /build/setup.sh

Run the env command to make sure they were set.

Pre-reqs:

Need Binutils

 # cd /build/binutils-2.16
 # ./configure --prefix=/usr/local
 # make
 # make install

Make sure you are using the newly installed binutils:

 # which ld
 /usr/local/bin/ld

 # ld -version
 GNU ld version 2.16
 Copyright 2005 Free Software Foundation, Inc.
 This program is free software; you may redistribute it under the terms of
 the GNU General Public License.  This program has absolutely no warranty.

Libiconv:

 # cd /build/libiconv-1.12
 # ./configure --prefix=/usr/local
 # make
 # make install

Unfortunately for PHP 4.x it requires some rather legacy C tools like Lex and Yacc which are now replaced with Flex and Bison so we need to compiled these:

The source can be downloaded from the GNU ftp site or from http://harorldatd003u.pubedu.hegn.us/pub/soft/src web server

Bison:

 # cd /build/bison-1.35
 # ./configure --prefix=/usr/local
 # make
 # make install

Flex:

 # cd /build/flex-2.5.4
 # ./configure --prefix=/usr/local
 # make
 # make test
 Check successful, using COMPRESSION=""

 # make install

Freetds:

Now we are ready to compile Freetds which is required by PHP to communicate with Microsoft SQL Server.

Notes:

http://us2.php.net/mssql

Important note: we have to use the release 0.63 NOT 0.82. It won't work with our older PHP 4.

Download from http://harorldatd003u.pubedu.hegn.us/pub/soft/src/freetds-0.63.tgz

WEe have some environment variable overrides to do for Freetds because ti will not build shared nor will it build using Sun's linker.

Setup our environment (from ksh):

 # . /build/setup.sh
 # LD=/usr/local/bin/ld; export LD
 # GCC_EXEC_PREFIX=/usr/local; export GCC_EXEC_PREFIX
 # CFLAGS="-m32 -mcpu=v9 -O2 -fno-exceptions"; export CFLAGS
 # CXXFLAGS="-m32 -mcpu=v9 -O2 -felide-constructors -fno-rtti"; export CXXFLAGS

REQUIRES GNU ld! /usr/ccs/bin/ld will NOT work here.

Unfortunately I found no better way then to temporarily disable /usr/ccs/bin/ld with GNU

 # cd /usr/ccs/bin
 # mv ld ld.orig
 # ln -s /usr/local/bin/ld ld

 # cd /build/freetds-0.63
 # ./configure --prefix=/usr/local --enable-static --disable-shared
 # make
 # make check
 # make install

Don't forget to update /usr/local/etc/freetds.conf with your database settings.

Put these lines at the end:

 [HARORLSQLD015]
        host = 167.208.157.159
        port = 1666
        tds version = 7.0
 [HARORLSQLP011]
        host = 167.208.157.180
        port = 1666
        tds version = 7.0

PHP:

Download php from http://www.php.net/downloads.php

Note as of Friday, August 8 PHP 4 is officially dead. You can continue to download PHP 4.4.87 from http://harorldatd003u.pubedu.hegn.us/pub/soft/src/php-4.4.8.tar.gz

 # cd /build/php-4.4.8

If we are starting over a new shell session reload our build environment (in ksh):

 # . /build/setup.sh

Redefine CFLAGS for PHP only:

 # CFLAGS="-O2 -pipe -fomit-frame-pointer"; export CFLAGS

Because of a bug in the way older PHP works with newer Freetds (0.82)

 # touch /usr/local/include/tds.h

They removed this header file from the newer releases and older PHP configure expects to see it.

 # ./configure --prefix=/usr/local  --with-apxs2=/local/dmt.rigbyfocusforward.com/apache2/bin/apxs  --with-config-file-path=/usr/local//etc --enable-track-vars  --without-bz2  --without-curl--without-cyrus --without-ldap  --without-fbsql --without-fdftk --without-fribidi --with-out-jpeg  --without-png --without-hwapi --without-imap  --without-informix --without-ingres --without-ircg --without-java --without-mcal  --without-mcrypt --without-mcve --without-ming --without-mnogosearch --without-msession  --without-ncurses --without-oracle --without-oci8 --without-ovrimos --disable-pcntl  --without-cpdflib --without-pdflib --without-pfpro --without-pgsql --without-pspell  --without-qtdom --without-readline --without-libedit --without-recode --without-swf  --without-sybase --without-sybase-ct --without-xslt-sablot --without-sablot-js  --without-expat-dir --disable-xslt --without-yaz --disable-yp --without-zip  --without-xml --without-dom --without-domxml --without-zlib --with-mssql=/usr/local

 # make
 # make test

This number is probably ok:

 Tests failed    :    3 (0.5%)

 # make install

Test our build:

 # /usr/local/bin/php -v
 PHP 4.4.8 (cli) (built: Jan 29 2008 13:29:16)
 Copyright (c) 1997-2008 The PHP Group
 Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

Copy in the php.ini from distribution:

 # cp php.ini-recommended /usr/local/etc/php.ini

Create Apache php.conf

Don't forget to add Include /usr/local/httpd/conf.d/php.conf in httpd.conf.

Edit /usr/local/httpd/conf.d/php.conf

 #
 # PHP is an HTML-embedded scripting language which attempts to make it
 # easy for developers to write dynamically generated webpages.
 #

 # This is already done in http.conf
 #LoadModule php4_module modules/libphp4.so

 #
 # Add PHP file types
 #
 AddType application/x-httpd-php .php
 AddType application/x-httpd-php-source .phps
 AddType application/x-httpd-php .inc
 AddType application/x-httpd-php .php

 #
 # Note: This is the old Apache 1.x syntax but I am leaving in commented
 # out for documentation sake
 #
 #
 # Cause the PHP interpreter handle files with a .php extension.
 #
 #<Files *.php>
 #    SetOutputFilter PHP
 #    SetInputFilter PHP
 #    LimitRequestBody 524288
 #</Files>

 #
 # Add index.php to the list of files that will be served as directory
 # indexes.
 #
 DirectoryIndex index.php

Test Apache configuration:

 # /usr/local/httpd/bin/apachectl configtest

 Config OK

Now restart Apache:

 # /usr/local/httpd/bin/apachectl restart

Kevin's Public Wiki maintained and created by Kevin P. Inscoe is licensed under a
Creative Commons Attribution 3.0 United States License.

Back to my web site - http://kevininscoe.com

Edit - History - Print - Recent Changes - Search
Page last modified on November 16, 2011, at 01:01 PM EST