faqts : Computers : Programming : Languages : PHP : Installation and Setup

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

17 of 19 people (89%) answered Yes
Recently 8 of 9 people (89%) answered Yes

Entry

Help, how to I get php4 to build on HPUX 10.20 with gcc 2.7.2 - the *time_r functions bomb it out

Jun 23rd, 2000 11:16
Vinnie Lima, Jim Sauber,


You most likely wont be able to compile it on HPUX 10.20. I had the same 
problem with attempting to install apache 1.3.12 + modssl + openssl + 
php4.  

Here's my list of "howto" for an HP-UX 10.20 system. Hope it helps!



How to install Apache Webserver 1.3.12 + SSL Capabilities + PHP3 
support. This should only be done by an EXPERIENCED HP-UX/UNIX admin 
only.  

Prerequisites
  _____________
  To use mod_ssl you need the following packages:

   o  Package:      Apache 
      Version:      1.3.x (latest is 1.3.12)
      Description:  The Apache Group HTTP Server
      Reason:       The webserver base package on which all is based
      Homepage:     http://www.apache.org/
      Distribution: ftp://ftp.apache.org/apache/dist/
      Tarball:      apache_1.3.x.tar.gz
      Location:     SF, USA
      Author(s):    The Apache Group <apache@apache.org>
      Type:         MANDATORY

   o  Package:      mod_ssl
      Version:      2.4.x
      Description:  The Apache Interface to OpenSSL
      Reason:       The interface module for Apache
      Homepage:     http://www.modssl.org/
      Distribution: ftp://ftp.modssl.org/source/
      Tarball:      mod_ssl-2.4.x-1.3.x.tar.gz
      Location:     Zurich, Switzerland, Europe
      Author(s):    Ralf S. Engelschall <rse@engelschall.com>
      Type:         MANDATORY

   o  Package:      OpenSSL
      Version:      0.9.x
      Description:  The Open Source Toolkit for SSL/TLS
      Reason:       The library which implements SSL/TLS
      Homepage:     http://www.openssl.org/
      Distribution: ftp://ftp.openssl.org/source/
      Tarball:      openssl-0.9.x.tar.gz
      Location:     Zurich, Switzerland, Europe
      Author(s):    The OpenSSL Project <openssl@openssl.org>
      Type:         MANDATORY 

   o  Package:      Mysql 
      Version:      3.22.29 for hp-hpux10.20
      Description:  SQL Database
      Reason:       To store data.
      Homepage:     www.mysql.com
      Distribution: Latest did not compile on 10.20 (3.22.32). 
                    Distribution installed on dianna webserver works 
  		  for all 10.20.
      HPUX Depot:   None available, either copy installed binary from 
  another 10.20 server or compile source.
      Type:         MANDATORY



   o  Package:      RSAref
      Version:      2.0
      Description:  RSA Reference Implementation
      Reason:       Deprecated RSA library for US citizens
      Homepage:     -
      Distribution: Search on http://ftpsearch.lycos.com/ for 
  "rsaref20.tar.Z" !!
      Tarball:      rsaref20.tar.Z
      Location:     Netherlands (because no longer distributed by RSA 
  DSI)
      Author(s):    RSA DSI
      Type:         OPTIONAL (only mandatory for US-citizens)


   o  Package:      MM
      Version:      1.0.x
      Description:  Shared Memory Library
      Reason:       The portable library for shared memory in 
  Apache/EAPI
      Homepage:     http://www.engelschall.com/sw/mm/
      Distribution: http://www.engelschall.com/sw/mm/
      Tarball:      mm-1.0.x.tar.gz
      Location:     Zurich, Switzerland, Europe
      Author(s):    Ralf S. Engelschall <rse@engelschall.com>
      Type:         OPTIONAL

   o  Package:      GZip
      Version:      1.2.4
      Description:  The compression utility
      Reason:       To unpack the above tarballs
      Homepage:     http://www.gnu.org/
      Distribution: ftp://ftp.gnu.org/pub/gnu/
      Tarball:      gzip-1.2.4.tar.Z
      Location:     USA
      Author(s):    Free Software Foundation (FSF)
      Type:         MANDATORY
 
   o  Package:      Perl
      Version:      5.6.0
      Description:  The Practical Extraction and Reporting Language
      Reason:       To configure OpenSSL and for APXS tool in Apache
      Homepage: 	  http://hpux.cae.wisc.edu
      Author(s):    Larry Wall
      Type:         MANDATORY

   o  Package:      GNU gcc 
      Version: 	  2.95.2
      Description:  Gnu C and C++ compilers
      Reason:       To compile all this stuff
      Homepage:     http://hpux.cae.wisc.edu
      Distribution: gcc-2.95.2
      HPUX Depot:   Varies depending on HPUX version
      Type:         MANDATORY

   o  Package:      GNU Make 
      Version: 	  3.79
      Description:  GNU make utility to maintain groups of programs
      Reason:       To make packages above.
      Homepage:     http://hpux.cae.wisc.edu
      Distribution: make-3.79
      HPUX Depot:   Varies depending on HPUX version
      Type:         MANDATORY

   o  Package:      binutils 
      Version:      2.9.1
      Description:  GNU binary utilities
      Reason:       To configure OpenSSL and for APXS tool in Apache
      Homepage:     http://hpux.cae.wisc.edu
      Distribution: binutiles-2.9.1
      HPUX Depot:   Varies depending on HPUX version
      Type:         MANDATORY

   o  Package:      bison 
      Version:      1.28
      Description:  GNU parsor generator
      Reason:       To configure OpenSSL and for APXS tool in Apache
      Homepage:     http://hpux.cae.wisc.edu
      Distribution: bison-1.28
      HPUX Depot:   Varies depending on HPUX version
      Type:         MANDATORY

   o  Package:      flex 
      Version: 	  2.5.4a
      Description:  A fast lexical analyser generator
      Reason:       To configure OpenSSL and for APXS tool in Apache
      Homepage:     http://hpux.cae.wisc.edu
      Distribution: flex-2.5.4a
      HPUX Depot:   Varies depending on HPUX version
      Type:         MANDATORY

   o  Package:      Gtk glib 
      Version: 	  1.2.8
      Description:  Useful library routines for C programming
      Reason:       Additional library routines required by packages.
      Homepage:     http://hpux.cae.wisc.edu
      Distribution: glib-1.2.8
      HPUX Depot:   Varies depending on HPUX version
      Type:         MANDATORY
   
   o  Package:      PHP version 3 
      Version: 	  3.0.16
      Description:  Hypertext Preprocessor.
      Reason:       To link databases to webpages.
      Homepage:     http://www.php.net
      Distribution: make-3.79
      Tarball:      http://www.php.net/download-php3.php
      Type:         MANDATORY


Installation
  ____________

  The following is a step-by-step list on how to install an SSL-aware 
Apache.  The actual steps you have to perform depend on the location 
where _YOU_ and  your webserver stay.  So the commands are marked at the 
right-side with the  following tags:
  
  US ... Command has to be run by citizens of the United States ONLY
  EU ... Command has to be run by citizens of a European state ONLY
  ALL .. Command has to be run by ANYONE, independent of location
  OPTIONAL .. Command is optional and not really needed

  Now follow these steps:
  (the syntax is for a Bourne-Shell style shell, when you're using a 
C-Shell  style shell you've to adjust the commands according to your 
shell's manual)

1) Make sure you have a brand new working HP-UX system. Installations 
for the 11.00 release will have to customize and probably custom build 
some of these applications. Instructions below on how to install some of 
the pre-required packages are brief and if further help is needed please 
refer to those individual Install help pages within the package 
distributions.

2) Install GNU gcc via swinstall. Add a Symbolic Link for the 
/opt/gcc/bin/gcc utility to the /usr/local/bin and /usr/bin directories 
by doing a ln -s /opt/gcc/bin/gcc /usr/local/bin/gcc  and /usr/bin/gcc  
If gcc is already in those directories, remove them. Make sure 
/opt/gcc/bin and the /usr/local/bin and /usr/bin directories are added 
to the /etc/PATH file.

3) Install GNU make via swinstall.  Follow the same symbolic link 
procedures as above as well as the /etc/PATH addition.

4) Install GNU Bison via swinstall. Follow the same symbolic link 
procedures as above as well as the /etc/PATH addition.

5) Install GNU binutils via swinstall. Follow the same symbolic link 
procedures as above as well as the /etc/PATH addition.

6) Install GNU flex via swinstall. Follow the same symbolic link 
procedures as above as well as the /etc/PATH addition.

7) Install Gtk glib via swinstall. Follow the same symbolic link 
procedures as above as well as the /etc/PATH addition.

8) Install Perl via swinstall. Follow the same symbolic link procedures 
as above as well as the /etc/PATH addition. You may have to delete the 
previous perl version, if it is already installed. 

9) If Gzip or a zip utility is not yet installed, then you must install 
one. HPUX already comes with a zip utility that works so you may not 
have any problems.

10) Install Mysql.  This will be tricky as I have yet had any luck 
compiling mysql latest (at this time it was 3.22.32) into a 10.20 
system.  Version 3.22.29 DOES compile on 10.20 systems, but 
unfortunately is not retrievable from their website. You may acquire a 
3.22.29 distribution from archived webserver and build it from source.  
You may also just move an already compiled 3.22.29 distribution from a 
10.20 system into your own HPUX system (this has worked on a transfer 
between two 10.20 systems). 

If building mysql from source, use the following switches when 
configuring it:  
   ./configure -prefix=/opt/mysql -enable-large-files 
-with-mysqld-user=username*

*where username = a system username dedicated for mysql and cannot 
telnet/ftp in the system 

11)	Extract the required packages:
     $ gzip -d -c apache_1.3.x.tar.gz | tar xvf -                  ALL
     $ gzip -d -c mod_ssl-2.4.x-1.3.x.tar.gz | tar xvf -           ALL
     $ gzip -d -c openssl-0.9.x.tar.gz | tar xvf -                 ALL
     $ gzip -d -c mm-1.0.x.tar.gz | tar xvf -                      ALL
     $ mkdir rsaref-2.0                                             US
     $ (cd rsaref-2.0; gzip -d -c ../rsaref20.tar.Z | tar xvf -)    US

12)	Configure and build the OpenSSL library: 
     (When you're an US-citizen you have to build OpenSSL in conjunction 
with the RSAref library. Others can ignore the first six commands, of 
course)

     $ cd rsaref-2.0
     $ cp -rp install/unix local                                    US
     $ cd local                                                     US
     (vi the makefile and change CC= "cc" to "gcc")
     $ make                                                         US
     $ mv rsaref.a librsaref.a                                      US
     $ cd ../..                                                     US

$ cd openssl-0.9.x                                                  ALL
     $ sh config \                                                  ALL
            no-idea \                                               EU
            -L`pwd`/../rsaref-2.0/local/ rsaref \                   US
            -fPIC                                                   ALL
     (vi the makefile and change CC= "cc" to "gcc")
     $ make                                                         ALL
     $ make test                                                    ALL
     $ cd ..                                                        ALL

13)	Optionally you now can build the MM Shared Memory library when 
you want shared memory support in Apache/EAPI. For instance this allows 
mod_ssl to use a high-performance RAM-based session cache instead of a 
disk-based one.

     $ cd mm-1.0.x                                                  ALL
     $ ./configure --disable-shared                                 ALL
     $ make                                                         ALL
     $ cd ..                                                        ALL


14)	You configure Apache manually and have the chance to configure 
and add third-party Apache modules like mod_perl, mod_php, 
mod_frontpage, mod_dav, etc. But you have to provide the SSL_BASE, 
RSA_BASE and EAPI_MM variables manually and either copy your existing 
certificate manually to conf/ssl.crt/server.crt or use `make 
certificate':

        $ cd mod_ssl-2.4.x-1.3.x                                    ALL
        $ ./configure \                                             ALL
              --with-apache=../apache_1.3.x \                       ALL
              --with-crt=/path/to/your/server.crt \                 ALL
              --with-key=/path/to/your/server.key                   ALL
        $ cd ..                                                     ALL

        $ cd apache_1.3.x                                           ALL
        $ SSL_BASE=../openssl-0.9.x \                               ALL
          RSA_BASE=../rsaref-2.0/local \                             US
          EAPI_MM=../mm-1.0.x \                                     ALL
          ./configure \                                             ALL
  --prefix=/path/to/apache \                            ALL
              --enable-module=ssl \                                 ALL
		  --enable-shared=max \						  
ALL
		  --disable-shared=ssl \					  
ALL
		  --enable-module=all \						  
ALL
        $ make                                                      ALL
        $ make certificate                                     OPTIONAL
        $ make install                                              ALL
        $ cd ..                                                     ALL

15) Now that you have built Apache as a DSO (Dynamically shared objects) 
you may add PHP3 as a module (be aware that PHP4 did NOT compile 
successfully!)
  $ cd php-3.0.16
  $ ./configure --with-mysql=/path/to/mysql 
--with-apxs=/path/to/apache/bin/apxs --with-xml
  $ make
  $ make install

16) At this point you need to edit your httpd.conf file and make 
necessary changes pertaining to your system information and webserver 
preferences.  Also Uncomment the PHP AddType line that looks like this:

AddType application/x-httpd-php3 .php3

You should also add a line to actually load the PHP module. Something 
like this will work:

LoadModule php3_module	modules/libphp3.so


17) Start the server by issuing the command /opt/apache/bin/apachectl 
start and then typing the ssl password chosen for your certificate (you 
DID save the password for the certificate, didn't you?).

You are done. 

If you want to enable Microsoft SQL/Sybase database connectivity via 
PHP, you need to do a few other steps and a MODIFIED step #15

1) Download FreeTDS from www.freetds.org. Latest version is 0.50. 
2) Unpack the distribution. Then compile it with the following options:
./configure -prefix=/path/where/to/install -with-msdblib 
-with-tdsver=7.0 (or 4.2 if you run into compile problems)

Once it finishes configuring, type the following commands:

make
make check
make install

3) Go to your /path/where/to/install and edit the interfaces file with 
your server information:

server1 
query tcp ether 192.168.1.12 1433 
master tcp ether 192.168.1.12 1433

4) (MODIFIED STEP #15 ABOVE) Compile PHP with an extra variable to 
enable this feature:

./configure --with-mysql=/path/to/mysql 
--with-apxs=/path/to/apache/bin/apxs --with-xml 
--with-sybase-ct=/path/of/freetds

5) Then type make and make install if no problems are found*

*If you run into problems while compiling, you may have to remove a 
bunch of library references to get it to compile. In the PHP makefile, 
look for freetds references on the APXS_LDFLAGS line, and remove any 
"-lxx" option(s) that cause you trouble. You may be only left with 
"-lct" and "-ldb". You may also have to modify the LIBS line.

6) Now use the PHP sybase functions to connect to the server you set up 
in the interfaces file:

$dbConn = sybase_pconnect("server1","user","password");