Skip to content

Instantly share code, notes, and snippets.

@phpdave
phpdave / Get the PHP Source and prerequisite binaries, run configure and make to compile.sh
Last active April 17, 2019 01:51
DISCLAIMER 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
#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:~
#get latest ibm_db2 php extension tarbal (can't use wget for https, using curl and ignoring ssl [we don't need this data encrypted])
#and installs it to /usr/local/phpdave7/lib/php/extensions/no-debug-non-zts-20160303/ibm_db2.so
#note depending on how PHP is configured on your system their will be either be a debug build or Zend Thread Safety (ZTS) builds of the extension
#$PREFIX/lib/php/extensions/no-debug-non-zts-API_NO for release builds without ZTS
#$PREFIX/lib/php/extensions/debug-non-zts-API_NO for debug builds without ZTS
#$PREFIX/lib/php/extensions/no-debug-zts-API_NO for release builds with ZTS
#$PREFIX/lib/php/extensions/debug-zts-API_NO for debug builds with ZTS
joe /usr/local/phpdave7/lib/php.ini
@phpdave
phpdave / gist:88f376dba0112cfbae19b9fa097793fb
Created April 6, 2019 00:39
Setting up google cloud natural language
setup follow https://cloud.google.com/natural-language/docs/reference/libraries#client-libraries-install-php
@phpdave
phpdave / page.php
Created March 20, 2015 16:41
WordPress: Get current level navigation menu items and their children 1 level deep
<?php
//Get the Page Id of the parent
if ($post->post_parent)
{
//There's a parent post lets get the ancestors and grab the top
$ancestors = get_post_ancestors($post->ID);
$parentPostId = $ancestors[count($ancestors) - 1];
}
else
{
@phpdave
phpdave / Changing yum to work when ftp is blocked.sh
Last active January 24, 2019 23:20
Instalingl Yum on IBM i
#1. Download the entire directory at ftp://public.dhe.ibm.com/software/ibmi/products/pase/rpms/repo
#2. Upload the entire directoy to IBM i ifs
#3. Change the baseurl in /QOpenSys/etc/yum/repos.d/ibm.repo to point to ifs directory
# FROM: baseurl=ftp://public.dhe.ibm.com/software/ibmi/products/pase/rpms/repo
# TO: baseurl=file:///path/to/local/repo
# EXTO: baseurl=file:///QOpenSys/etc/yum/IBMRepoLocalMirror/repo
vi /QOpenSys/etc/yum/repos.d/ibm.repo
@phpdave
phpdave / Get Nginx Source and prerequisite binaries, run configure and make to compile.sh
Created June 25, 2016 23:52
Compile Nginx on IBM i PASE AIX. DISCLAIMER 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
#some things we may need:
wget http://www.oss4aix.org/download/RPMS/zlib/zlib-devel-1.2.8-1.aix5.1.ppc.rpm
rpm --ignoreos --ignorearch --nodeps --replacepkgs -hUv zlib-devel-1.2.8-1.aix5.1.ppc.rpm
#nginx: [emerg] using regex "\.php$" requires PCRE library in /usr/local/nginx/conf/nginx.conf:72
wget http://www.oss4aix.org/download/RPMS/pcre/pcre-8.35-1.aix5.1.ppc.rpm
rpm --ignoreos --ignorearch --nodeps --replacepkgs -hUv pcre-8.35-1.aix5.1.ppc.rpm
wget http://www.oss4aix.org/download/RPMS/pcre/pcre-devel-8.35-1.aix5.1.ppc.rpm
rpm --ignoreos --ignorearch --nodeps --replacepkgs -hUv pcre-devel-8.35-1.aix5.1.ppc.rpm
alias db2='function _db2(){ echo "Running $1"; system -i "call QSYS/QZDFMDB2 parm('\''$1'\'')"; };_db2'
db2 "SELECT * FROM MYLIB.MYTABLE"
#Get fancy and search the data
db2 "SELECT * FROM MYLIB.MYTABLE" | grep "Smith"
#Alternatively you can run it through qsh - https://kadler.github.io/2018/05/29/calling-qsh-utilities-from-pase.html
@phpdave
phpdave / pseudoKillJobsGivenFile.sql
Last active May 10, 2018 22:24
Pseudo logic - Kill all jobs on a file in IBMi 7.2 to remove record locks
CREATE PROCEDURE MYLIB.KILLJOBSGIVENFILE ( )
LANGUAGE SQL
SPECIFIC MYLIB.KILLJOBSSP
BEGIN
--Variable to control loop
DECLARE END_TABLE INT DEFAULT 0;
--If there's no record update END_TABLE to 1 to end the loop
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET END_TABLE = 1;
@phpdave
phpdave / httpd.conf
Last active April 19, 2018 13:22
IBM i apache config for Zend Server https/ssl
# Load the SSL module into Apache
LoadModule ibm_ssl_module /QSYS.LIB/QHTTPSVR.LIB/QZSRVSSL.SRVPGM
# Listen for HTTPS traffic
Listen 10.1.1.200:80
Listen 10.1.1.200:443
NameVirtualHost 10.1.1.200:443
# MYApp - Redirect to HTTPS
<VirtualHost 10.1.1.201:80>
@phpdave
phpdave / ibm_db2.c
Last active November 13, 2017 23:03
/*
+----------------------------------------------------------------------+
| Copyright IBM Corporation 2005-2014 |
+----------------------------------------------------------------------+
| |
| Licensed under the Apache License, Version 2.0 (the "License"); you |
| may not use this file except in compliance with the License. You may |
| obtain a copy of the License at |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |