Skip to content

Instantly share code, notes, and snippets.

@phpdave
Last active January 23, 2017 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phpdave/430973e8e2d90e0a03b12236715ec3c4 to your computer and use it in GitHub Desktop.
Save phpdave/430973e8e2d90e0a03b12236715ec3c4 to your computer and use it in GitHub Desktop.
Install PHP and Nginx on Litmis space - Created 2 pkgs for installing PHP and Nginx from Perzl RPMs
#get onto litmis
ssh usrcis42@spaces.litmis.com
#git ibmichroot project
git clone https://bitbucket.org/PHPDave/ibmichrootpulled1.22.2017 -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_setup.sh pkg_perzl_php-7.0.13.lst
#Verify PHP-cli binary runs
/opt/freeware/bin/php -v
#Verify php-fpm can run on 127.0.0.1:9000 for Nginx to send requests to
/opt/freeware/sbin/php-fpm
joe /opt/freeware/etc/php-fpm.d/www.conf
#Download nginx and dependencies
./pkg_setup.sh 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 http://spaces.litmis.com:61183/
#Some other documentation
#https://gist.github.com/phpdave/f8f56e5cb42c9f293c4ed02c7de8c30d
#Get IBM Db2
wget http://yips.idevcloud.com/wiki/uploads/XMLService/ibm_db2-1.9.9-zs5-php7.zip
#or compile from src http://yips.idevcloud.com/wiki/uploads/XMLService/ibm_db2-1.9.9-zs5-full-src.zip
wget http://www.oss4aix.org/download/RPMS/unzip/unzip-6.0-2.aix5.1.ppc.rpm
rpm --ignoreos --ignorearch --nodeps --replacepkgs -hUv unzip-6.0-2.aix5.1.ppc.rpm
unzip ibm_db2-1.9.9-zs5-php7.zip
#--add extension=ibm_db2.so
joe /opt/freeware/etc/php.ini
#--copy to extension dir
cp ibm_db2.so /opt/freeware/lib/php/modules/ibm_db2.so
# Command:
# > ./pkg_setup.sh pkg_perzl_nginx-1.11.8-1.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
#
:rpm
#Nginx
http://www.oss4aix.org/download/RPMS/nginx/nginx-1.11.8-1.aix5.3.ppc.rpm
#Nginx Dependencies
http://www.oss4aix.org/download/RPMS/GeoIP/GeoIP-1.5.1-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/GeoIP/GeoIP-devel-1.5.1-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/libxslt/libxslt-1.1.29-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/libxslt/libxslt-devel-1.1.29-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/gd/gd-2.0.35-5.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/gd/gd-devel-2.0.35-5.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/libgcrypt/libgcrypt-1.6.6-1.aix5.2.ppc.rpm
http://www.oss4aix.org/download/RPMS/fontconfig/fontconfig-2.12.0-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/libgpg-error/libgpg-error-1.23-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/expat/expat-2.2.0-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/gcc/libgcc-4.8.4-1.aix5.3.ppc.rpm
# Command:
# > ./pkg_setup.sh 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
#
:rpm
# PHP
http://www.oss4aix.org/download/RPMS/php/mod_php_ap22-7.0.13-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/php/mod_php_ap24-7.0.13-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/php/php-cli-7.0.13-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/php/php-common-7.0.13-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/php/php-devel-7.0.13-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/php/php-fpm-7.0.13-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/php/php-opcache-7.0.13-1.aix5.1.ppc.rpm
#Dependencies
http://www.oss4aix.org/download/RPMS/bzip2/bzip2-1.0.2-4.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/curl/curl-7.51.0-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/freetype2/freetype2-2.7-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/libjpeg/libjpeg-9b-2.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/libpng/libpng-1.6.26-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/libmcrypt/libmcrypt-2.5.8-5.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/libssh2/libssh2-1.8.0-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/libtool/libtool-ltdl-2.4.6-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/libxml2/libxml2-2.9.4-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/libXpm/libXpm-3.5.11-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/openssl/openssl-1.0.2j-2.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/openldap/openldap-2.4.23-0.5.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/pcre/pcre-8.39-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/xz/xz-libs-5.2.2-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/zlib/zlib-1.2.3-7.aix5.1.ppc.rpm
#http://www.oss4aix.org/download/RPMS/libiconv/libiconv-1.14-3.aix5.1.ppc.rpm
#Apache
#http://www.oss4aix.org/download/RPMS/apache/httpd-2.2.31-1.aix5.1.ppc.rpm
#
# 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;
fastcgi_pass 127.0.0.1:9001;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
<?php
//phpinfo();
$database = '*LOCAL';
$username = 'USRYB87R';
$password = '';
$db2Connection = db2_connect($database , $username , $password );
echo 'Connection Result for '.$database.':';
var_dump($db2Connection);
echo '<br>';
if(!$db2Connection)
{
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() ;}
$ID=1;
db2_bind_param($sql_statement, 1, "ID", DB2_PARAM_IN);
db2_execute($sql_statement);
$row = db2_fetch_assoc($sql_statement);
var_dump($row);
//Output:
//Connection Result for *LOCAL:resource(2) of type (DB2 Connection)
//array(1) { ["00001"]=> string(10) "2017-01-23" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment