HP Nonstop (Installation instructions for PHP)

Posted by Faiz on June 5th, 2009 filed in HP NonStop Application Support

Installation instructions for PHP 4 on an HP Nonstop Server

 

Those instructions are for installing PHP 4 on an HP Nonstop Server only. They are not valid for any other operating system.

 

This note also replaces the standard PHP 4 installation file for HP Nonstop Servers.

 

Considerations

 

PHP 4 can be run on an HP NonStop Servers as a CGI program, launched by the iTP Webserver. This installation note does not allow PHP to run as a module or as a specific Pathway server. Although this installation has been tested by HP employees, it is not supported by HP and the GCSC (NonStop Servers support center) will not enter cases for PHP issues.

 

If you would like support for PHP running on an HP Nonstop server, please enter a bug report in http://bugs.php.net, and specify the operating system version (e.g. HP Nonstop Server G06.13)

 

Versions

 

This installation procedure has been tested successfully on G06 and D48 systems.

 

Installation

 

  1. Unpack the distribution file.You will have downloaded a tar.gz file (not the bz2 file). For example php-4.2.1.tar.gz. Place the file in the top directory where you want to install php. For example: /home/dev/php

    Unzip this file like this:

    gunzip php-4.2.1.tar.gz

    This will create a file called php-4.2.1.tar. Untar the file:

    tar –xvf php-4.2.1.tar

    This will create a php-4.2.1 directory. Change directory to php-4.2.1:

    cd php-4.2.1

  2. Create a directory called nsk and go in the directory:mkdir nsk
    cd nsk

  3. The c89 compiler on HP Nonstop Servers do not automatically search for procedures in the system libraries when a file is being compiled. This causes a problem with the standard ./configure script, which will behave incorrectly, thinking that every procedure it is looking for exists on the system. This behavior is due to the fact that the linking of system procedures is made the first time the program is ran (called fixup time). If you do not use the script below, you will get undefined externals and illegal instructions when you run PHP, even though the compilation may have completed without errors.The script below gathers procedure names from the system SRLs, and creates a wrapper for the C compiler that will get around the problem described above.

    Note that although this script can be used to install other open source software that is built via Autoconf, it has been specifically tested for PHP, and there is no guarantee that it will work for other programs.

    Create a file called makeprocs which will contain the following script:

    #!/bin/sh

 

echo “\nStarting to build the procedure list from your system..\n”

 

# First get the current sysnn

 

sysnn=$(gtacl -p ’sysinfo’ | grep SYSnn | awk ‘{print $3}’)

 

echo “You are running on $sysnn.”

 

# Get the list of SRLs to look for. This is libc.obey

 

srllist=$(sed ’s/-l//’ </usr/lib/libc.obey)

srllist=”$srllist TSYSCLR”

 

# For each srl, call nm to extract the procedure names, and store that

# in a file.

# The grep and sed commands remove the extra information and just keep

# the procedure names. The last sed command changes the OSS_xxx_ proc names

# to xxx (e.g. OSS_gethostbyname_ to gethostbyname).

 

for srl in $srllist; do

  fullname=”/G/SYSTEM/$sysnn/$srl”

  echo “Extracting info from $fullname…” >&2

  nm $fullname | egrep ‘(^_EXP#)|(^_ORG#)|(^\$m_)’ | sed ’s/\([^ ]*\).*/\1/p’ \

     | sed ’s/^_EXP#//’ | sed ’s/^_ORG#//’ | sed ’s/^OSS_\([a-z]*\)[_]/\1/’

done >procs

 

echo “Done.. Now creating nskcc..”

 

# Now make a fake cc so that the Configure script will work properly. I call

# it ‘nskcc’, then set the following environment variables. After this is

# done, ./Configure and the subsequent make will run properly.

#

# CC=nskcc

# CPP=”c89 -E” Note that this means C preprocessor, not the Cplusplus compiler.

# CPPFLAGS=”-D_XOPEN_SOURCE_EXTENDED=1 -Wextensions -Wnowarn=1506,262,707,304″

 

# Remove our previous test file if any.

# launch the c compiler with the options given by the caller.

 

cat >nskcc <<EOM

#!/bin/sh

 

# first check if this is a test run

if [ "\$1" = "-test" ]

then

   test=true

   shift

fi

 

# See if we’re called from configure. If not, just run the c compiler

# otherwise do the procedure check

 

PARENT=\$(ps -p\$(ps -p\$\$ -oppid=”") -oargs|tail -1)

if test “\$test” = “true” || echo \$PARENT|grep -q ‘[cC]onfigure’

then

rm -f nskt

 

# Look for the name of the object file.

 

obj=\`echo \$* | sed ’s/.*-o \([A-Za-z0-9.]*\) .*/\1/’\`

 

# Try the compilation. Return immediately if failed.

 

c89 \$* || exit \$?

 

# if a procedure is undefined, it will appear like this:

# (none)    : gethostbyname

#

# use grep/sed to extract the procedure names that are undefined.

# we FAIL if there is one procedure undefined, even if the other is

# good. ./configure will rarely check more than one proc at a time

# so that should work 99%.

 

noft “file \$obj;llf” 2>/dev/null | grep “^(none)” | sed ’s/^(none)[ ]*: //’ >nskt

 

# if nskt is not empty, then there is a procedure that was not found in

# the srl, either because it was not declared properly, or because it’s

# in the tsysclr. In that case, try to find our procedure in the procs file.

#

# If the procedure is not found, exit with status 1. That way, ./configure will

# think cc failed and consider the procedure to not work.

 

if test -s nskt; then

   proclist=\`cat nskt\`

   for proc in \$proclist; do

      grep -q “^\$proc\\\$” \$PROCSFILE || exit 1

   done

fi

else

# script called from something else than configure, so just run c89.

c89 \$*

fi

exit

EOM

chmod +x nskcc

 

# Now tell user to set the env variables so ./configure uses our nskcc program.

 

echo “Now set the following environment variables and run ./configure.”

 

echo “export PATH=\$PATH:./nsk (or the full path of nsk)”

echo “export CPP=\”c89 -E\”"

echo “export CC=nskcc”

echo “export PROCSFILE=”

echo “export CPPFLAGS=\”-D_XOPEN_SOURCE_EXTENDED=1 -Wextensions -Wnowarn=1506,262,707,304\”"

echo “export LD=nld”

 

echo “Now run ./configure”

exit

 

  1. Execute the script. This will load the SRL information, and create two new files in the nsk directory:chmod +x makeprocs
    ./makeprocs

    You should see an equivalent to the following output:

    Starting to build the procedure list from your system..

 

You are running on SYS00.

Extracting info from /G/SYSTEM/SYS00/zcresrl…

Extracting info from /G/SYSTEM/SYS00/zcrtlsrl…

Extracting info from /G/SYSTEM/SYS00/zossksrl…

Extracting info from /G/SYSTEM/SYS00/zossfsrl…

Extracting info from /G/SYSTEM/SYS00/zsecsrl…

Extracting info from /G/SYSTEM/SYS00/zi18nsrl…

Extracting info from /G/SYSTEM/SYS00/zicnvsrl…

Extracting info from /G/SYSTEM/SYS00/zossesrl…

Extracting info from /G/SYSTEM/SYS00/zinetsrl…

Extracting info from /G/SYSTEM/SYS00/zstfnsrl…

Extracting info from /G/SYSTEM/SYS00/zosshsrl…

Extracting info from /G/SYSTEM/SYS00/TSYSCLR…

Done.. Now creating nskcc..

Now set the following environment variables and run ./configure.

export PATH=$PATH:./nsk (or the full path of nsk)

export CPP=”c89 -E”

export CC=nskcc

export PROCSFILE=

export CPPFLAGS=”-D_XOPEN_SOURCE_EXTENDED=1 -Wextensions -Wnowarn=1506,262,707,304″

export LD=nld

Now run ./configure

 

  1. You should then have the following files in the nsk directory:makeprocs nskcc procs

    The makeprocs file is the script you just ran.
    nskcc is the c89 wrapper.
    procs is a list of system procedures.

  2. Set the following environment variables:export PATH=$PATH:/home/dev/php-4.2.1/nsk (assuming that you installed php in /home/dev/php-4.2.1)
    export CPP=”c89 –E”
    export CC=nskcc
    export PROCSFILE=/home/dev/ph-4.2.1/nsk/procs (assuming that you installed php in /home/dev/php-4.2.1)
    export CPPFLAGS=”-D _XOPEN_SOURCE_EXTENDED=1
     –Wextensions –Wnowarn=1506,262,707,304”
    export LD=nld

    The PATH variable will tell make where to find the c89 wrapper (nskcc).
    The CPP variable stands for C PreProcessor. Those are the flags needed to run the preprocessor.
    CC is set to nskcc, which is our c89 wrapper.
    PROCSFILE should point to the file “procs” that was created after you ran makeprocs.
    CPPFLAGS are the c89 compiler flags. They specify that part of the source is XOPEN compliant, and some XOPEN header files should be included, Wextensions is necessary for TAL headers, and some warnings have been suppressed from the output as they should not cause any problem with this installation.

  3. Run the ./configure script.
    cd ..
    ./configure –without-mysql –host=nsr-tandem-nsk
    mysql is built by default on other PHP platform. Since mysql is not available on HP Nonstop Servers, it has to be disabled.This installation does not include non standard, experimental or platform specific extensions. If you wish to include specific extensions, they may not compile correctly on HP Nonstop Servers. Look for future revisions of this note as extensions are tested on HP Nonstop Servers.

    You may want to install PHP in a different directory that the default one, or enable/disable configuration options like short tags, safe mode, etc.. Look at http://www.php.net/manual/en/install.configure.php for a list of configuration options that you can change.

    When you run ./configure you should see the following after the first 10 lines or so:

    checking how to run the C preprocessor… c89 –E
    checking for gcc… nskcc

    If ./configure fails and doesn’t show that it is using nskcc or c89, check that your environment variables are set correctly.

    Continue reading the output of configure until it says “Running system checks”.  Few lines later, you may notice that it says that it didn’t find ieeefp.h. This is normal and should not be changed.

    Verify that asctime_r returns no. If you fall into INSPECT, you didn’t set the environment variables correctly, and the wrapper is not used, or it’s not working properly.

    Verify that gethostbyaddr returns yes. If it does, then everything is fine. If it returns no, then you have not installed the wrapper correctly.

  4. Once the configuration is over, you can now compile php. Just type make.
    You will see some warnings (mostly warning # 770). Those are okay, and won’t prevent PHP from compiling successfully.

  5. At the end of the compilation process, you should have a php object in the main php-4.2.1 directory. Check that it compiled okay without undefined externals:./php –v

    This should return:

    4.2.1 (or the version that you installed).

  6.  Install PHP
    make install

  7. Configure iTP Webserver to run php
    cd to /usr/tandem/webserver/conf
    edit the mime-types.config file
    add the following entries:MimeType application/x-httpd-guardian php
    PathwayMimeMap php generic-cgi

     

  8. Restart the iTPWebserver
    You can now test a simple php script:#/usr/local/bin/php
    <?php
    phpinfo();
    ?>


Building with extensions:

This installation note has not been tested with additional extensions. Some extensions are known to be working well on HP NonStop Servers, some need some tweaking before a full compilation can be achieved. Future versions of this note may include information on extensions that have been compiled successfully and run well on NonStop Servers.

 

Pathway, NSK architecture, Enscribe, SQLMP/MX and other HP NonStop Server specifics with PHP:


This installation note explains how to install and run PHP under Pathway as a CGI server. PHP does not take advantage of the NSK architecture, and will not be able to access SQLMP, Enscribe or other HP Nonstop Servers proprietary code. However, an Enscribe extension is being developed that will allow you to open, read, write and create enscribe files. SQL/MX access via the unified ODBC interface should also be available in the end of 2002 or beginning of 2003.

PHP Performance on HP Nonstop Servers is being evaluated. Watch out for performance information in an update of this installation note.

 

Getting a PHP binary for HP Nonstop Servers.

 

This is not offered yet, but it should be available in the near future.

 

Running PHP under Apache on HP Nonstop Servers, or running PHP under Guardian

 

Apache has not been officially ported by HP on HP Nonstop Servers. The official webserver is iTPWebserver, which takes full advantage of the HP Nonstop technologies, including multiple cpus, load balancing, fault tolerance to name a few. iTPWebserver does not run

Comments are closed.