Below is a simple way of installing RPMs needed to get PHP 7.0.13 & Nginx 1.11.8-1 running on an IBM i Power System.  By the end of it you’ll be able to send http requests to that are answered by nginx and passed to php-fpm to process.

#get onto litmis
#git ibmichroot project
git clone -c http.sslVerify=false
#switch to chroot project
cd ibmichrootpulled1.22.2017/pkg/
#Create PHP Pkg with content attached to this gist
joe pkg_perzl_php-7.0.13.lst
#Install PHP rpms from Perzl
./ pkg_perzl_php-7.0.13.lst
#Verify PHP-cli binary runs
/opt/freeware/bin/php -v
#Verify php-fpm can run on for Nginx to send requests to
joe /opt/freeware/etc/php-fpm.d/www.conf
#Download nginx and dependencies
./ pkg_perzl_nginx-1.11.8-1.lst
#Install Nginx – the pkg downloads it but this command has to run to install it
rpm –ignoreos –ignorearch –replacepkgs –nodeps -hUv –noscripts nginx-1.11.8-1.aix5.3.ppc.rpm
#configure Nginx to use php-fpm
joe /etc/nginx/nginx.conf
#setup nginx server – see file attached to gist – sets up the port and the connection to php-fpm
joe /etc/nginx/conf.d/virtual.conf
# we wont use the deafult config so we'll delete it
rm /etc/nginx/conf.d/default.conf
#start nginx
/etc/rc.d/init.d/nginx start
#create a test.php file to have nginx run and pass to PHP.
echo "<?php phpinfo(); ?>" >> /QOpenSys/opt/freeware/share/nginx/html/index.php
rm /QOpenSys/opt/freeware/share/nginx/html/index.html
#On browser go to
#Some other documentation
#Get IBM Db2
#or compile from src
rpm –ignoreos –ignorearch –nodeps –replacepkgs -hUv unzip-6.0-2.aix5.1.ppc.rpm
joe /opt/freeware/etc/php.ini
#–copy to extension dir
cp /opt/freeware/lib/php/modules/

# Command:
# > ./ pkg_perzl_php-7.0.13.lst
# Use:
# > export PATH=/opt/freeware/bin:$PATH
# > export LIBPATH=/opt/freeware/lib:$LIBPATH (if error, remove ':$LIBPATH')
# > any_util (below)
# Notes:
# requires pkg_perzl_gcc-4.8.3.lst
# rpm list

# A virtual host using mix of IP-, name-, and port-based configuration
server {
listen 61183;
# listen somename:8080;
# server_name somename alias another.alias;
location / {
root html;
index index.php index.html index.htm;
location ~* \.php$ {
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;

view raw
hosted with ❤ by GitHub

$database = '*LOCAL';
$username = 'USRYB87R';
$password = '';
$db2Connection = db2_connect($database , $username , $password );
echo 'Connection Result for '.$database.':';
echo '<br>';
echo 'db2_conn_error():'.db2_conn_error()."<br>";
echo 'db2_conn_errormsg():'.db2_conn_errormsg()."<br>";
$sql_query = "select current date from sysibm.sysdummy1";
$sql_statement = db2_prepare($db2Connection, $sql_query);
if($sql_statement ===false) {echo 'Prepare Failed – Error: ' . db2_stmt_error() . "|".db2_stmt_errormsg() ;}
db2_bind_param($sql_statement, 1, "ID", DB2_PARAM_IN);
$row = db2_fetch_assoc($sql_statement);
//Connection Result for *LOCAL:resource(2) of type (DB2 Connection)
//array(1) { ["00001"]=> string(10) "2017-01-23" }

view raw
hosted with ❤ by GitHub