Skip to content

Instantly share code, notes, and snippets.

Avatar

UseTheForceDave phpdave

View GitHub Profile
@phpdave
phpdave / Location of various PHP related fiels.md
Last active May 25, 2018
Zend Server 9.1 on IBM i PHP 7.1.3
View Location of various PHP related fiels.md
@phpdave
phpdave / InstallZS91onIBMi.sh
Last active Sep 20, 2017
Automate installing ZS91 on your IBM i. Note the zendphp7.savf is 1.5GB
View InstallZS91onIBMi.sh
#wget http://downloads.zend.com/zendserver/9.1.0/ZendServer-9.1.0-php-7.1.3-IBM-i.zip
wget http://downloads.zend.com/zendserver/9.1.1/ZendServer-9.1.1-php-7.1.7-IBM-i.zip
#unzip ZendServer-9.1.0-php-7.1.3-IBM-i
unzip ZendServer-9.1.1-php-7.1.7-IBM-i
scp zendphp7.savf QSECOFR@MYIBMi.example.com:/tmp/
ssh QSECOFR@MYIBMi.example.com system "\"CPYFRMSTMF FROMSTMF('/tmp/zendphp7.savf') TOMBR('/QSYS.LIB/QGPL.LIB/ZENDPHP7.FILE')\""
ssh QSECOFR@MYIBMi.example.com system "\"SBMJOB CMD(RSTLICPGM LICPGM(7PHPZND) DEV(*SAVF) SAVF(QGPL/zendphp7))\""
View Alias for partition 2017 .sql
CREATE OR REPLACE ALIAS QTEMP.SALES_2017
FOR SALES(2017);
--https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/db2/rbafzhcalias.htm
View AphpXMLParser.php
<?php
$xml = simplexml_load_file('jcrcmds.xml');
$outputdir='./results';
!file_exists($outputdir)?mkdir(outputdir, 0700):"";
foreach ($xml->mbr as $mbr)
{
$filename=$outputdir.'/'.trim($mbr['mbrname']).'.rpg';
$data=(string) $mbr->copysrc;
file_put_contents($filename,$data);
echo $filename.' created.'.PHP_EOL;
@phpdave
phpdave / phpunit.xml
Created Mar 2, 2017
phpunit xml config example
View phpunit.xml
<phpunit colors="true" bootstrap="tests/phpunits/bootstrap.php">
<testsuites>
<!--
<testsuite name="All">
<directory>tests/phpunits/</directory>
</testsuite>
-->
<testsuite name="Project1">
<file>tests/phpunits/app3.example.com/1Test</file>
<file>tests/phpunits/app4.example.com/2Test.php</file>
View SetUpSelenium.sh
#Get composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
#Create composer.json in project
{
"require-dev": {
"phpunit/phpunit": "*",
@phpdave
phpdave / index.php
Last active Feb 26, 2017
Testing out the latest version of PHP7 and DB2 adapter on spaces.litmis.com. Also trying out new database features in IBM i 7.3. http://spaces.litmis.com:61184/
View index.php
<?php
$db2Connection = doConnect();
dosql("CREATE OR REPLACE TABLE DJTGR_D.ATEST1 (ID BIGINT)");
dosql("CREATE OR REPLACE TABLE DJTGR_D.ATEST2 (ID BIGINT)");
dosql("SELECT * FROM QSYS2.TABLES WHERE TABLE_SCHEMA = 'DJTGR_D'");
dosql("CALL QSYS2.GENERATE_SQL('MYTABLE4#', 'DJTGR_D', 'TABLE')");
dosql("CALL QSYS2.GENERATE_SQL('MY%', 'DJTGR_D', 'TABLE')");
dosql("select current date from sysibm.sysdummy1");
dosql("CREATE OR REPLACE TABLE DJTGR_D.MYTABLE4# (
ID BIGINT GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1, NO ORDER, NO CYCLE, NO MINVALUE, NO MAXVALUE, CACHE 20) NOT HIDDEN ,
View system-period temporal table.sql
--Creates the temporal table
CREATE OR REPLACE TABLE PHP_DAVE1.DEPT
(DEPTNO CHAR(3) NOT NULL,
DEPTNAME VARCHAR(36) NOT NULL,
MGRNO CHAR(6),
ADMRDEPT CHAR(3) NOT NULL,
LOCATION CHAR(16),
START_TS TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS ROW BEGIN,
END_TS TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS ROW END,
TS_ID TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS TRANSACTION START ID,
View ibm_db2-2.0.1
/*
+----------------------------------------------------------------------+
| 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 |
| |
@phpdave
phpdave / Install_perzl_php_and_nginx.sh
Last active Jan 23, 2017
Install PHP and Nginx on Litmis space - Created 2 pkgs for installing PHP and Nginx from Perzl RPMs
View Install_perzl_php_and_nginx.sh
#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