Note: this is currently is a draft and is not meant to be used yet.  Many things that I’m looking to clean up and simplify.  There may be things that don’t work so only do this on a development system that you aren’t worried about it being fubar’d

Step 1 – Have SSH access to an IBM i or get a Litmis space IBM i container

  1. If you already have an IBM i you can make sure you have SSH enabled by going through this tutorial http://yips.idevcloud.com/wiki/index.php/PASE/SSHSetup
    Watch out for any gotchas by looking here: https://godzillaibmi.com/2015/07/25/setting-up-ssh-for-ibmi-gotchas/
  2. If you don’t have an IBM i you can sign up at https://spaces.litmis.com/ for a litmis space container.  Use the promo code “BETA”
  3. Sign up with your Github, Linkedin or Google+ account
  4. After signing in setup your litmis container. (Note: you can only have 1 container unless you decide to purchase an account).
  5. Click the shell icon “>_” to get into a SSH window inside your browser.  Alternatively you can find the information for your account and use your SSH client of choice.

Step 2 – Get the PHP Source and prerequisite binaries, run configure and make to compile

#DISCLAIMER: this is currently is a draft and is not meant to be used yet. Many things that I'm looking to clean up and simplify. There may be things that don't work so only do this on a development system that you aren't worried about it being fubar'd
#Download PHP source code and change directories to the downloaded src. This is a dev version of PHP. git.php.net is official. http://www.github.com/php/php-src is mirror
git clone http://git.php.net/repository/php-src.git && cd php-src
#Alternative get a certain branch (version), the default is the master branch which is development
#git clone -b PHP-5.6.7 http://git.php.net/repository/php-src.git
#specific to litmis space not having the includes on a fresh container
#local
scp qopensys-usr-include.tar.gz usrcis42@spaces.litmis.com:~
#remote
tar -xvf qopensys-usr-include.tar.gz
#Fix Error: "make: Cannot open the internal rules file /usr/ccs/lib/aix.mk."
mkdir -p /usr/ccs
ln -s /QOpenSys/usr/ccs/lib /usr/ccs/lib
#Get gcc
git clone https://bitbucket.org/litmis/ibmichroot.git -c http.sslVerify=false
cd ibmichroot
./pkg_setup.sh pkg_perzl_gcc-4.8.3.lst
# apparently need a sym link to the /usr/bin/gcc
ln -sf /opt/freeware/bin/gcc /usr/bin/gcc
#make sure we have all the include files that are needed (i.e. standards.h,strict_stdtypes.h,sys/inttypes.h) that are specified in /QOpenSys/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.3/include-fixed/
ls -all /QOpenSys/usr/include
#Get autoconf 2.63
wget ftp://www.oss4aix.org/RPMS/autoconf/autoconf-2.63-1.aix5.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs –oldpackage -hUv autoconf-2.63-1.aix5.1.ppc.rpm
#Get make 4.1
wget ftp://www.oss4aix.org/everything/RPMS/make-4.1-1.aix5.3.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs –oldpackage -hUv make-4.1-1.aix5.3.ppc.rpm
#Fix /bin/sh: egrep: not found
wget ftp://www.oss4aix.org/RPMS/grep/grep-2.24-1.aix5.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs –oldpackage -hUv grep-2.24-1.aix5.1.ppc.rpm
#Fix /opt/freeware/bin/autoconf[505]: /opt/freeware/bin/autom4te: not found
#Setup perl into our /usr/bin/perl directory (soft symbolic link) as this is used by autoconf[line number: 1]:
ln -s /opt/freeware/bin/perl /usr/bin/perl
#Fix autom4te: need GNU m4 1.4 or later: /opt/freeware/bin/m4
#careful! don't go too far into the future releases of m4 or you'll run into problems like:
# /opt/freeware/bin/m4: internal error detected; please report this bug to <bug-m4@gnu.org>: Illegal instruction
# zsh: illegal hardware instruction (core dumped) /opt/freeware/bin/m4 –version
#Using the perzl m4 this is what I found out:
#1.4.10 – works
#1.4.11 – works
#1.4.12 – illegal hardware instruction (core dumped)
#1.4.13+ – /opt/freeware/bin/m4: internal error detected; please report this bug to bug-m4@gnu.org: Illegal instruction
wget http://gnome.bullfreeware.com/aixtoolbox/RPMS/ppc/m4/m4-1.4.13-1.aix5.3.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs –oldpackage -hUv m4-1.4.13-1.aix5.3.ppc.rpm
#/opt/freeware/bin/m4 –version
#FIX: Could not load program /opt/freeware/bin/m4:
# Dependent module /opt/freeware/lib/libsigsegv.a(libsigsegv.so.0)
wget ftp://www.oss4aix.org/RPMS/libsigsegv/libsigsegv-2.10-1.aix5.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs –oldpackage -hUv libsigsegv-2.10-1.aix5.1.ppc.rpm
#libtool 2.2.10-1
wget ftp://www.oss4aix.org/RPMS/libtool/libtool-2.2.10-1.aix5.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs -hUv –force libtool-2.2.10-1.aix5.1.ppc.rpm
wget http://gnome.bullfreeware.com/aixtoolbox/RPMS/ppc/curl/curl-7.47.1-1.aix6.1.ppc.rpm
wget http://gnome.bullfreeware.com/aixtoolbox/RPMS/ppc/curl/curl-devel-7.47.1-1.aix6.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs –oldpackage -hUv curl-7.47.1-1.aix6.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs –oldpackage -hUv curl-devel-7.47.1-1.aix6.1.ppc.rpm
wget ftp://www.oss4aix.org/RPMS/m4/m4-1.4.17-1.aix5.1.ppc.rpm
rpm –allmatches –nodeps –noscripts –notriggers -e m4
rpm –ignoreos –ignorearch –nodeps –replacepkgs -hUv m4-1.4.17-1.aix5.1.ppc.rpm
#Setup path to use opt/freeware/bin first so that we use the GNU make instead of AIX make
export PATH=/opt/freeware/bin:$PATH
#Setup LIBPATH we neeed to get libm.a for the xml build test
export LIBPATH=/opt/freeware/lib:/QOpenSys/usr/lib:/usr/ccs/lib:/QOpenSys/usr/lib/X11:.:/usr/lib:$LIBPATH
#build configure – The git repository doesn’t bundle a configure script, so buildconf creates it for us using autoconf.
./buildconf
#If you've run build conf before and have done a git pull of new code then run buildconf –force
#./buildconf –force
#get bison
wget ftp://www.oss4aix.org/RPMS/bison/bison-3.0.4-1.aix5.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs –oldpackage -hUv bison-3.0.4-1.aix5.1.ppc.rpm
#if you need an earlier version of bison
wget ftp://www.oss4aix.org/RPMS/bison/bison-2.7.1-1.aix5.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs –oldpackage -hUv bison-2.7.1-1.aix5.1.ppc.rpm
#configure needs re2c
wget ftp://www.oss4aix.org/RPMS/re2c/re2c-0.14.2-1.aix5.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs -hUv re2c-0.14.2-1.aix5.1.ppc.rpm
#need core utils for cut – used to find bison version. NOTE: –noscripts
wget ftp://www.oss4aix.org/RPMS/coreutils/coreutils-8.25-2.aix5.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –noscripts –replacepkgs -hUv -v coreutils-8.25-2.aix5.1.ppc.rpm
#need libxml2 for configure
wget ftp://www.oss4aix.org/RPMS/libxml2/libxml2-devel-2.9.0-1.aix5.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs -hUv -v libxml2-devel-2.9.0-1.aix5.1.ppc.rpm
wget ftp://www.oss4aix.org/RPMS/libxml2/libxml2-2.9.0-1.aix5.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs -hUv -v libxml2-2.9.0-1.aix5.1.ppc.rpm
#fix Dependent module liblzma.a(liblzma.so.0) could not be loaded.
wget ftp://www.oss4aix.org/everything/RPMS/xz-libs-5.0.4-1.aix5.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs -hUv -v xz-libs-5.0.4-1.aix5.1.ppc.rpm
#make ran into this issue
#libtool: link: cannot find the library `/opt/freeware/lib/liblzma.la' or unhandled argument `/opt/freeware/lib/liblzma.la'
ls -l /opt/freeware/lib/liblzma*
#we are missing it…
#-rwxr-xr-x 1 usrcis42 0 890568 Sep 17 2012 /opt/freeware/lib/liblzma.a
#xz-devel has /opt/freeware/lib/liblzma.la
#-rwxr-xr-x 1 usrcis42 0 920 Dec 28 14:45 /opt/freeware/lib/liblzma.la
wget ftp://www.oss4aix.org/RPMS/xz/xz-devel-5.2.2-1.aix5.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs -hUv -v xz-devel-5.2.2-1.aix5.1.ppc.rpm
#keeping references to these in case they are also needed
#ftp://www.oss4aix.org/everything/RPMS/xz-5.2.2-1.aix5.1.ppc.rpm
#ftp://www.oss4aix.org/everything/RPMS/xz-devel-5.2.2-1.aix5.1.ppc.rpm
#ftp://www.oss4aix.org/everything/RPMS/xz-lzma-compat-5.2.2-1.aix5.1.ppc.rpm
#symlink needed as php looks in /home/db2inst1/sqllib/include/ for sql headers
#checking for IBM DB2 support… configure: error: ODBC header file '/home/db2inst1/sqllib/include/sqlcli1.h' not found!
mkdir -p /home/db2inst1/sqllib/include
ln -sf /QOpenSys/usr/include /home/db2inst1/sqllib
#might be needed (reference: https://bugs.php.net/bug.php?id=34089 )
wget ftp://www.oss4aix.org/RPMS/zlib/zlib-1.2.3-4.aix5.2.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs -hUv -v zlib-1.2.3-4.aix5.2.ppc.rpm
wget ftp://www.oss4aix.org/RPMS/zlib/zlib-devel-1.2.3-4.aix5.2.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs -hUv -v zlib-devel-1.2.3-4.aix5.2.ppc.rpm
wget ftp://www.oss4aix.org/RPMS/freetype2/freetype2-2.6.2-1.aix5.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs -hUv -v freetype2-2.6.2-1.aix5.1.ppc.rpm
wget ftp://www.oss4aix.org/RPMS/freetype2/freetype2-devel-2.6.2-1.aix5.1.ppc.rpm
rpm –ignoreos –ignorearch –nodeps –replacepkgs -hUv -v freetype2-devel-2.6.2-1.aix5.1.ppc.rpm
#back to php-src dir
cd ../php-src/
#I have multiple configures since I'm tweaking it for various reasons. You only need to run configure once, don't run all the configures below….
#Run configure 1 – This was my first configure and im not sure if i got it to work
export PATH=/opt/freeware/bin:/usr/local/bin:$PATH
export LIBPATH=/opt/freeware/lib:/usr/local/lib:/QOpenSys/usr/ccs/lib/:$LIBPATH
export IBM_DB_HOME=/usr
export CCHOST=powerpc-ibm-aix6.1.0.0
export CFLAGS="-O2 -pipe -g -DPASE=1 -DAIX_PASE=1 -DVIRTUAL_DIR=1 -I ~/php-src"
export LDFLAGS="-Wl,-bbigtoc -static-libgcc"
export CXXFLAGS="-DPASE=1 -DAIX_PASE=1 -DVIRTUAL_DIR=1 -O2 -I ~/php-src"
export CC=gcc
export CXX=g++
./configure –build=powerpc-ibm-aix6.1.0.0 –host=powerpc-ibm-aix6.1.0.0 –target=powerpc-ibm-aix6.1.0.0 –cache-file=../config.cache –prefix=/usr/local/php_7_0_0 –disable-all\
–mandir=/usr/local/php_7_0_0/man –with-config-file-path=/usr/local/php_7_0_0/etc –with-config-file-scan-dir=/usr/local/php_7_0_0/etc/php.d –disable-debug –enable-inline-optimization\
–with-openssl=/opt/freeware –with-pear –with-gd –with-zlib –with-bz2 –with-curl=/opt/freeware –enable-libxml –with-iconv-dir=/opt/freeware \
–with-freetype-dir=/opt/freeware –with-jpeg-dir=/opt/freeware –with-ldap=/opt/freeware –with-pdo-sqlite –with-sqlite3 –with-png-dir=/opt/freeware –with-xpm-dir=/opt/freeware\
–with-zlib-dir=/opt/freeware –enable-pdo –enable-soap –enable-bcmath –enable-ftp –enable-sockets –enable-session –enable-xml –with-libxml-dir=/usr/local/libxml2-2.9.0\
–enable-dom –enable-json –with-mcrypt=/opt/freeware –with-pcre-regex=/opt/freeware –enable-ctype –enable-filter –enable-simplexml –enable-hash –with-layout=GNU\
–enable-mbstring –enable-xmlwriter –enable-xmlreader –enable-opcache –enable-sysvmsg –enable-zip \
–with-mysqli=mysqlnd \
–enable-sysvsem \
–enable-sysvshm \
–with-apxs2=/usr/local/Zend/apache2/bin/apxs \
#Run Configure 2 with the options we want –
#This configure i got PHPCLI and FPM running
export LDFLAGS='-L/QOpenSys/usr/ccs/lib -lm'
export PATH=/opt/freeware/bin:/usr/local/bin:$PATH
export LIBPATH=/opt/freeware/lib:/usr/local/lib:/QOpenSys/usr/ccs/lib/:$LIBPATH
export CC=gcc
export CFLAGS=-O3
./configure –cache-file=../config.cache \
–enable-fpm \
–prefix=/usr/local/phpdave7 \
–with-config-file-path=/usr/local/phpdave7/etc \
–with-config-file-scan-dir=/usr/local/phpdave7/etc/conf.d \
–with-libxml-dir=/QOpenSys/opt/freeware/ \
–build=powerpc-ibm-aix6.1.0.0 \
–host=powerpc-ibm-aix6.1.0.0 \
–disable-xml –without-pear –with-iconv=/usr/linux –disable-xml –without-pear –with-iconv=/usr/linux &> ConfigureResults.txt && gmake clean &> GmakeCleanResults.txt && gmake &> GmakeResults.txt && gmake test &> GmakeTestResults.txt
#configure 3
#This configure i'm working on integrating Apache with PHP
export LDFLAGS='-L/QOpenSys/usr/ccs/lib -lm'
export PATH=/opt/freeware/bin:/usr/local/bin:$PATH
export LIBPATH=/opt/freeware/lib:/usr/local/lib:/QOpenSys/usr/ccs/lib/:$LIBPATH
export CC=gcc
export CFLAGS=-O3
./configure \
–build=powerpc-ibm-aix6.1.0.0 –host=powerpc-ibm-aix6.1.0.0 \
–prefix=/usr/local/phpdave7 –with-config-file-path=/usr/local/phpdave7/etc –with-config-file-scan-dir=/usr/local/phpdave7/etc/conf.d \
–with-libxml-dir=/QOpenSys/opt/freeware/ –enable-fpm –disable-xml –without-pear –with-iconv=/usr/linux –with-apxs2=/QOpenSys/opt/freeware/bin/apxs \
–with-config-file-path=/usr/local/phpdave7/etc –with-config-file-scan-dir=/usr/local/phpdave7/etc/php.d –enable-inline-optimization –enable-mbstring –enable-opcache –enable-sysvsem –enable-sysvshm &> ConfigureResults.txt && gmake clean &> GmakeCleanResults.txt && gmake &> GmakeResults.txt && gmake install &> GmakeInstallResults.txt
#configure 4
#This configure is probably experimental
#exportCFLAGS="-O2 -pipe -g -DPASE=1 -DAIX_PASE=1 -DVIRTUAL_DIR=1 -I LDFLAGS=-Wl,-bbigtoc -static-libgcc"
#export CXXFLAGS="-DPASE=1 -DAIX_PASE=1 -DVIRTUAL_DIR=1 -O2 -I"
export IBM_DB_HOME=/usr
export CCHOST=powerpc-ibm-aix6.1.0.0
export CFLAGS="-O2 -pipe -g -DAIX_PASE=1 -DVIRTUAL_DIR=1 -I ~/php-src"
export LDFLAGS='-Wl,-bbigtoc -static-libgcc -L/QOpenSys/usr/ccs/lib -lm '
export CXXFLAGS="-DPASE=1 -DAIX_PASE=1 -DVIRTUAL_DIR=1 -O2 -I ~/php-src"
export CC=gcc
export CXX=g++
export PATH=/opt/freeware/bin:/usr/local/bin:$PATH
export LIBPATH=/opt/freeware/lib:/usr/local/lib:/QOpenSys/usr/ccs/lib/:$LIBPATH
./configure \
–build=powerpc-ibm-aix6.1.0.0 –host=powerpc-ibm-aix6.1.0.0 –target=powerpc-ibm-aix6.1.0.0 –cache-file=../config.cache \
–prefix=/usr/local/phpdave7 –with-config-file-path=/usr/local/phpdave7/etc –with-config-file-scan-dir=/usr/local/phpdave7/etc/conf.d –disable-debug \
–with-libxml-dir=/QOpenSys/opt/freeware/ –enable-fpm –disable-xml –without-pear –with-iconv=/usr/linux –with-apxs2=/QOpenSys/opt/freeware/bin/apxs \
–with-config-file-path=/usr/local/phpdave7/etc –with-config-file-scan-dir=/usr/local/phpdave7/etc/php.d –with-ibm-db2 –enable-inline-optimization –enable-mbstring –enable-opcache –enable-sysvsem –enable-sysvshm &> ConfigureResults.txt && gmake clean &> GmakeCleanResults.txt && gmake &> GmakeResults.txt && gmake install &> GmakeInstallResults.txt
#configure 5
#This configure is probably experimental
#export LDFLAGS='-Wl,-bbigtoc -static-libgcc -L/QOpenSys/usr/ccs/lib -lm '
export IBM_DB_HOME=/usr
export CCHOST=powerpc-ibm-aix6.1.0.0
export CFLAGS="-O2 -pipe -g -DPASE=1 -DAIX_PASE=1 -DVIRTUAL_DIR=1 -I ~/php-src"
export LDFLAGS='-Wl,-bbigtoc -static-libgcc'
export CXXFLAGS="-DPASE=1 -DAIX_PASE=1 -DVIRTUAL_DIR=1 -O2 -I ~/php-src"
export CC=gcc
export CXX=g++
export PATH=/opt/freeware/bin:/usr/local/bin:$PATH
export LIBPATH=/opt/freeware/lib:/usr/local/lib:/QOpenSys/usr/ccs/lib/:$LIBPATH
./configure \
–build=powerpc-ibm-aix6.1.0.0 –host=powerpc-ibm-aix6.1.0.0 –target=powerpc-ibm-aix6.1.0.0 –cache-file=../config.cache –prefix=/usr/local/phpdave7 –disable-all –mandir=/usr/local/phpdave7/man –with-config-file-path=/usr/local/phpdave7/etc –with-config-file-scan-dir=/usr/local/phpdave7/etc/php.d –disable-debug –enable-inline-optimization –with-openssl=/opt/freeware –with-pear –with-gd –with-zlib –with-bz2 –with-curl=/opt/freeware –enable-libxml –with-iconv-dir=/opt/freeware –with-freetype-dir=/opt/freeware –with-jpeg-dir=/opt/freeware –with-ldap=/opt/freeware –with-pdo-sqlite –with-sqlite3 –with-png-dir=/opt/freeware –with-xpm-dir=/opt/freeware –with-zlib-dir=/opt/freeware –enable-pdo –enable-soap –enable-bcmath –enable-ftp –enable-sockets –enable-session –enable-xml –with-libxml-dir=/QOpenSys/opt/freeware/ –enable-dom –enable-json –with-mcrypt=/opt/freeware –with-pcre-regex=/opt/freeware –enable-ctype –enable-filter –enable-simplexml –enable-hash –with-layout=GNU –enable-mbstring –enable-xmlwriter –enable-xmlreader –enable-opcache –enable-sysvmsg –enable-zip –with-mysqli=mysqlnd –enable-sysvsem –enable-sysvshm –with-apxs2=/QOpenSys/opt/freeware/bin/apxs –enable-fpm \
&> ConfigureResults.txt
gmake clean &> GmakeCleanResults.txt
gmake &> GmakeResults.txt
gmake install &> GmakeInstallResults.txt
/*–disable-all >option is very useful if you want a fast build and don’t need much functionality (e.g. when implementing language changes). For the smallest possible build you can additionally specify the –disable-cgi switch, so only the CLI binary is generated.*/
#no enable fpm probably missing something
#ld: 0711-317 ERROR: Undefined symbol: .WCOREDUMP
#ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
#collect2: error: ld returned 8 exit status
#Makefile:289: recipe for target 'sapi/fpm/php-fpm' failed
#gmake: *** [sapi/fpm/php-fpm] Error 1
#FIX: modified fpm_children.c in /sapi/fpm adding
joe sapi/fpm/fpm/fpm_children.c
/*
#ifndef WCOREDUMP
#define WCOREDUMP(x) 0
#endif
*/
#–enable-fpm \
#After running configure
joe Makefile
#orig
#PHP_CLI_OBJS = sapi/cli/php_cli.lo sapi/cli/php_http_parser.lo sapi/cli/php_cli_server.lo sapi/cli/ps_title.lo sapi/cli/php_cli_process_title.lo
PHP_CLI_OBJS = sapi/cli/php_cli.lo sapi/cli/php_http_parser.lo sapi/cli/php_cli_server.lo sapi/cli/ps_title.lo sapi/cli/php_cli_process_title.lo $(PHP_BINARY_OBJS)
#orig
#PHP_CGI_OBJS = sapi/cgi/cgi_main.lo
PHP_CGI_OBJS = sapi/cgi/cgi_main.lo sapi/cgi/fastcgi.lo main/internal_functions.lo
# Did not fix iconv problem: –with-iconv-dir=/QOpenSys/opt/freeware/include
<<OTHEROPTIONS
http://php.net/manual/en/configure.about.php
#Don't compile php with ibm-db2. Do it seperately w/ pecl or compile from source
–with-ibm-db2 \
–with-curl=/opt/freeware \
–with-iconv-dir=/opt/freeware \
–with-freetype-dir=/opt/freeware \
–with-jpeg-dir=/opt/freeware \
–with-ldap=/opt/freeware \
–with-pdo-sqlite \
–with-sqlite3 \
–with-png-dir=/opt/freeware \
–with-xpm-dir=/opt/freeware \
–with-zlib-dir=/opt/freeware \
–with-bz2 \
–with-gd \
–enable-pdo \
–enable-soap \
–enable-bcmath \
–enable-ftp \
–enable-sockets \
–enable-session \
–enable-xml \
–with-libxml-dir=/usr/local/libxml2-2.9.0 \
–enable-dom \
–enable-json \
–with-mcrypt=/opt/freeware \
–with-pcre-regex=/opt/freeware \
–enable-ctype \
–enable-filter \
–enable-simplexml \
–enable-hash \
–with-layout=GNU \
–enable-mbstring \
–enable-xmlwriter \
–enable-xmlreader \
–enable-opcache \
–enable-sysvmsg \
–enable-zip \
–with-mysqli=mysqlnd \
–enable-sysvsem \
–enable-sysvshm \
–with-apxs2=/usr/local/Zend/apache2/bin/apxs \
–disable-debug \
–enable-inline-optimization \
–disable-all \
–enable-libxml \
–with-libxml-dir=/usr/local/libxml2-2.7.7 \
–enable-session \
–enable-spl \
–enable-xml \
–enable-hash \
–enable-reflection \
–with-pear \
–with-apxs2=/usr/local/apache2/bin/apxs \
–with-layout=GNU \
–enable-filter \
–with-pcre-regex \
–with-zlib=/usr \
# or just –with-zlib
–enable-simplexml \
–enable-dom \
–enable-soap \
–with-openssl=/usr \
–enable-pdo \
–with-pdo-sqlite \
–with-sqlite3 \
–enable-zmail
OTHEROPTIONS
# –with-libxml-dir=/QOpenSys/opt/freeware/
# will get xml2_config in /QOpenSys/opt/freeware/bin/xml2-config
# fixes configure: error: xml2-config not found. Please check your libxml2 installation.
#collect2: fatal error: library libm not found
#compilation terminated.
#make: The error code from the last command is 1.
export LIBPATH=/QOpenSys/usr/ccs/lib
#makes it worse with
#ld: 0706-006 Cannot find or open library file: -l m
# ld:open(): No such file or directory
#this fixed the libm issues ("collect2: fatal error: library libm not found")
export LDFLAGS='-L/QOpenSys/usr/ccs/lib -Wl,-bbigtoc -static-libgcc'
#Generating phar.php
#/bin/sh[14]: /home/USRCIS42/php-src/sapi/cli/php: not found
#make: The error code from the last command is 127.
#Some explanation – https://bugs.php.net/bug.php?id=35888
#https://www.experts-exchange.com/questions/27951853/AIX-Compile-error.html
#if we had a previous make we can clean it up
gmake clean
#compile the objects and link them
gmake
#run the test to make sure everything is working
gmake test
#Make test stops indefinetly at:
#TEST 82/10450 [tests/basic/timeout_variation_0.phpt]
#need to fix Zend/zend_execute_API.c
#//# ifdef CYGWIN
##if defined(CYGWIN) || defined(_AIX)
# on line 1263
#install the files into the directories they should be in
gmake install
# Installing shared extensions: /usr/local/phpdave7/lib/php/extensions/no-debug-non-zts-20160303/
# Installing PHP CLI binary: /usr/local/phpdave7/bin/
# Installing PHP CLI man page: /usr/local/phpdave7/php/man/man1/
# Installing PHP FPM binary: /usr/local/phpdave7/sbin/
# Installing PHP FPM config: /usr/local/phpdave7/etc/
# Installing PHP FPM man page: /usr/local/phpdave7/php/man/man8/
# Installing PHP FPM status page: /usr/local/phpdave7/php/php/fpm/
# Installing phpdbg binary: /usr/local/phpdave7/bin/
# Installing phpdbg man page: /usr/local/phpdave7/php/man/man1/
# Installing PHP CGI binary: /usr/local/phpdave7/bin/
# Installing PHP CGI man page: /usr/local/phpdave7/php/man/man1/
# Installing build environment: /usr/local/phpdave7/lib/php/build/
# Installing header files: /usr/local/phpdave7/include/php/
# Installing helper programs: /usr/local/phpdave7/bin/
# program: phpize
# program: php-config
# Installing man pages: /usr/local/phpdave7/php/man/man1/
# page: phpize.1
# page: php-config.1
# /home/USRCIS42/php-src/build/shtool install -c ext/phar/phar.phar /usr/local/phpdave7/bin
# ln -s -f phar.phar /usr/local/phpdave7/bin/phar
# Installing PDO headers: /usr/local/phpdave7/include/php/ext/pdo/
structure of make install
$PREFIX
|— bin
| |— pear*
| |— peardev*
| |— pecl*
| |— phar –> /home/myuser/myphp/bin/phar.phar*
| |— phar.phar*
| |— php*
| |— php-cgi*
| |— php-config*
| `— phpize*
|— etc
| `— pear.conf
|— include
| `— php
| |— ext/
| |— include/
| |— main/
| |— sapi/
| |— TSRM/
| `— Zend/
|— lib
| `— php
| |— Archive/
| |— build/
| |— Console/
| |— data/
| |— doc/
| |— OS/
| |— PEAR/
| |— PEAR5.php
| |— pearcmd.php
| |— PEAR.php
| |— peclcmd.php
| |— Structures/
| |— System.php
| |— test/
| `— XML/
`— php
`— man
`— man1/
#add path to the php binaries folder so we can run php, phpize without specify the whole to our $PATH environment variable
echo "export PATH=/usr/local/phpdave7/bin/:$PATH" >> ~/.zprofile
#set it up for current session
export PATH=/usr/local/phpdave7/bin/:$PATH
#verify php is working!
php -v
# PHP 7.1.0-dev (cli) (built: Jun 2 2016 18:38:42) ( NTS )
# Copyright (c) 1997-2016 The PHP Group
# Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
#if gmake starts doing: gmake: *** virtual memory exhausted. Stop.
#install a different version
#wget ftp://www.oss4aix.org/RPMS/make/make-4.0-1.aix5.3.ppc.rpm
#wget ftp://www.oss4aix.org/RPMS/make/make-4.1-1.aix5.3.ppc.rpm
#rpm –ignoreos –ignorearch –nodeps –replacepkgs –oldpackage -hUv make-4.0-1.aix5.3.ppc.rpm
#rpm –ignoreos –ignorearch –nodeps –replacepkgs –oldpackage -hUv make-4.1-1.aix5.3.ppc.rpm
Makefile:457: recipe for target '/home/USRCIS42/php567/php-src/Zend/zend_language_parser.c' failed
gmake: *** [/home/USRCIS42/php567/php-src/Zend/zend_language_parser.c] Broken pipe
#FIXED was using bison 2.7.12-4996 and upgraded to bison 3.0.4

Step 3 – Compiling and setting up the Webserver (Nginx or Apache)

Step 4 – Compiling IBM DB2 PHP Extension Module