PHP in the Enterprise

Function Junction Mike Pavlak Solutions Consultant [email protected]

© All rights reserved. Zend Technologies, Inc. Agenda

•Market analysis •Evolution of PHP and IBM i •PHP stacks up today •PHP in the IBM i Enterprise •Development Community •Mobile •Zend Interpretations of IBM market

2 © All rights reserved. Zend Technologies, Inc. PHP in the Enterprise www.zend.com

Market Analysis

© All rights reserved. Zend Technologies, Inc. Market Overview With a community of over 5 million developers, PHP usage has significantly broadened in recent years

Functions of PHP apps have become diverse

What type of application(s) have you built with PHP?

60% of PHP apps are developed for Base: 117 respondents who are actively using PHP Data: UBM TechWeb BUSINESS CRITICAL PURPOSES Survey of 232 executives, architects or development managers actively using PHP or considering building apps using PHP, May 2012

CLOUD & MOBILE USAGE is a now a core design point 72% 2/3 63% of PHP Developers of PHP developers of developers are are using cloud based expect to work on creating apps for services & APIs mobile apps in 2012 cloud deployment

© All rights reserved. Zend Technologies, Inc.

Key Trends in PHP Compared to your next most-used language, is PHP better or worse at…

© All rights reserved. Zend Technologies, Inc. What Is Fueling this Enterprise Adoption?

Software Hardware • Complexity of other web • Server consolidation languages (Java, .Net, etc.) • Front-ending web applications to • PHP’s comparative ease of use host data • Web application re-engineering • Manageability of n-tiered applications • Price/performance • Price/performance • TCO • TCO • Enterprise-readiness of PHP driven by Zend

© All rights reserved. Zend Technologies, Inc. Zend Has Driven Dynamics of Making PHP Enterprise Ready

Enterprise PHP

Enterprise Web Strategic Zend Tooling via Application Platforms Framework Eclipse Server Integrations

© All rights reserved. Zend Technologies, Inc. Launched internet based PHP education…$75 for three month program 67% of developers spend 50% of their time on PHP…(Developer Pulse) PHP is easier to learn than Ruby or JavaScript…It doesn’t have to be OO

© All rights reserved. Zend Technologies, Inc. Market Overview Research shows that expansion has been driven by benefits in speed of development and ease of working with the cloud

What are the main reasons you choose to Compared with your next most-used language, is develop in PHP? PHP better or worse at each of the following?

Note: Multiple responses allowed Data: UBM TechWeb Survey of 232 executives, architects or development managers actively using PHP or considering building apps using PHP, May 2012

Base: 117 respondents who are actively using PHP Data: UBM TechWeb Survey of 232 executives, architects or development managers actively using PHP or considering building apps using PHP, May 2012 © All rights reserved. Zend Technologies, Inc. PHP in the Enterprise www.zend.com

Evolution of PHP and IBM i

© All rights reserved. Zend Technologies, Inc. Adoption of PHP on the IBM i • IBM & Zend meet… SystemiNetwork, COMMON, etc. identify need for scripting on IBM i. • Net.Data is good, but not strategic Zend CEO and VP of Business Development come to COMMON

• IBM & Zend dance… IBM and Zend strike a BP relationship IBM helps Zend port PHP to IBM i

• The romance Anticipate a few thousand downloads Well past 11,000 unique registrations(nearly 400 monthly sustained) Customer moves from intrigue to conviction

• Happily ever after… Let’s just say, both sides are quite pleased with where this is going Competition is taking notice

11 © All rights reserved. Zend Technologies, Inc. Zend Server for IBM i

•Next generation of PHP stack for IBM I •Single Licensed Program Installation •Two products, single distribution, enable via keys Zend Server for IBM i Community Edition • Available at no charge per IBM partnership Zend Server for IBM i • Subscription available from Zend • High value extra features • Higher Support SLAs

12 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.

3 2012 Q

2 2012 Q

1 2012 Q MySQL

9 Expanded IBM Partnership to to Partnership

4 2011 Q

Zend

Growth in Developer

Cloud Users A Great Year for Zend in the Cloud the in Zend for Year Great A PHP in the Enterprise www.zend.com

How the PHP Market Stacks Up Today

© All rights reserved. Zend Technologies, Inc. Top 10 Internet Sites by WW traffic

1. Facebook.com 6. Wikipedia.com

2. Google.com 7. Live.com

3. Youtube.com 8. Amazon.com

4. Yahoo.com 9. qq.com

5. Baidu.com 10. Twitter.com 5 more in next 10

© All rights reserved. Zend Technologies, Inc. Jan 2013 15 Enterprise PHP Adoption is Growing Rapidly

PHP Developers

5M “Commercial and corporate IT 4M developers will account for more than 2 million PHP community 3M members—growing from 20% to 50% of the worldwide PHP 2M developer population.”

1M

2009 2014

Non-commercial developers

Commercial and corporate IT developers

Gartner Research Note: “PHP: Past, Present and Future”, Dec. 2nd, 2009

© All rights reserved. Zend Technologies, Inc. IBM i Customer! Enterprise Proof Points

© All rights reserved. Zend Technologies, Inc. Blog article…PHP jobs and IBM i

Comment: “I am an it director at a window manufacturer outside Cleveland Ohio. We use RPG extensively, but a few years ago I began writing and implementing , html, etc running on apache using db2 via odbc. It has taken us to new levels ...” Adam Vanbuskirk

18 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. PHP in the Enterprise www.zend.com

Mobile

© All rights reserved. Zend Technologies, Inc. “Mobile 0.5” – First-Gen Mobile Apps

CLIENT HTML

• “Dumbed-down” web interface • UI = server based • Limited, “as is” desktop to • No APIs mobile device Today’s Mobile Apps

CLIENT BACK- END SYSTEMS

APIs

Enterprise systems and data sources

• Native apps • Server-side APIs “hacked” • Too many devices to support into existing systems “Mobile First” Approach

Context is All Touch vs. QWERTY

Users: Part of Your Design Team Pervasive Reach The Future – Cloud-Connected Mobile Apps

BACK- END SYSTEMS

MOBILE CLIENTS APIs

Cloud Services Architecture

• Provide services to clients • Composite architecture SOCIAL AND SAAS Web-driven native experience • Elastic scaling PHP in the Enterprise www.zend.com

Zend Interpretations

© All rights reserved. Zend Technologies, Inc. Key Priorities articulated by CTOs, CIOs and VPs of Engineering

•Leverage investment in IBM i infrastructure Expose DB2/400 data via the web Webify green screen applications for end-users •Maximize leverage of Power Systems computing power Move Windows/Linux based PHP apps to IBM i Deploy new web based applications •Mitigate and minimize risk/cost of migrations •Retool RPG programmers and access lower cost development resources to address business needs •Leverage benefits of open-source technologies - create portable applications 1/8/ 25 201 © All rights reserved. Zend Technologies, Inc. 3 Why PHP on i?

• Powerful , Flexible, & Fastest Growing Web Leverage Existing Development Language Infrastructure to • Native on IBM i/OS Develop & Run Dynamic • Backing & Support of IBM Web Applications Easily • Controlled/Driven by PHP Community • Easy to Use & Fast to Deploy • Supports Heterogeneous Environments • Powerful Integration Capabilities

Application Modernization Access RPG Consolidate Data in Use PHP to web-enable green screen Programs & Data as DB2/400 applications, utilizing existing data & Web Services Move PHP applications that are business logic without rewriting running on Windows or Linux application Package programs and data as web services and make that access data in DB2 to run available to other web in IBM i/OS to speed up or applications reduce complexity of the applications

Access DB2/400 Data New/Packaged Web via Browser Application on IBM i/OS Easily access and interact with Create new applications with PHP on DB2/400 data using a standard IBM i/OS or leverage thousands of web browser existing Open Sources applications

26 26 © All rights reserved. Zend Technologies, Inc. Zend commitment to IBM i

•Zend Server 6 Q1-2013 Both in beta •Zend Studio 10 Q1-2013 right now! •PHP Toolkit 6 major releases in 2012, more coming •Market presence COMMON User Groups Blogs, webcasts, white papers ISV – BCD, Crosspoint, Harris Data, NSC, iGuazu, etc.

27 © All rights reserved. Zend Technologies, Inc. What are you doing?

•Pick an application and say…

MOBILE FIRST!

28 © All rights reserved. Zend Technologies, Inc. Resources •Recorded Webinars http://www.zend.com/en/resources/webinars/IBM i-os

•Zend Server for IBM i main page, link to downloads http://www.zend.com/en/products/server/zend-server-ibm-i

•Zend Server manual:

PDF: http://www.zend.com/topics/Zend-Server-5-for-IBMi-Reference-Manual.pdf

Online: http://files.zend.com/help/Zend-Server-5/zend- server.htm#installation_guide.htm

29 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. Q&A

www.zend.com

[email protected]

Please fill out your Session Evaluation!

30 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. Advanced Functions with DB2 and PHP for IBM i

Mike Pavlak Solution Consultant

© All rights reserved. Zend Technologies, Inc. Agenda

•DB2 features in V5R4, i6.1 and i7.1 •Review DB2 functions in PHP •Explore the possibilities •Q&A

2 © All rights reserved. Zend Technologies, Inc. Three primary ingredients to PHP script

3 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. DB2 Wiki - https://www.ibm.com/developerworks/ibmi

4 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. IBM changed the update process

•Version – Major release Technology refresh - #5 released to GA and more coming… •Why do I care? - Rising tide raises all boats… In other words, improvements in DB2, SQL and especially SQE will improve features and performance in all languages like • Java • RPG • COBOL • Of, of course PHP! And, ODBC, JDBC, ADO

5 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.

Subscribe to blog and get notified!

•http://db2fori.blogspot.com/

6 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. DB2 features V5R4

Insert7 ->Header & Footer © All rights reserved. Zend Technologies, Inc. V5R4 DB2

•Free format embedded SQL (RPG) •PHP DB2 interface was delivered (back-leveled to V5R3) •Automatic journaling enhancements •SQE makes its debut in V5R2 and gets tweaked in V5R4 •Speed enhancements of SPL •System i Navigator enhancements •Content Manager delivered. •Much more…

8 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. V5R4 DB2

•Sunset is on the horizon •September 30, 2013 – EOL for V5R4

•Extended support for a fee, but Get thyself to i6.1 or higher!

9 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. DB2 features IBM i6.1

Insert10 ->Header & Footer © All rights reserved. Zend Technologies, Inc. Lots of new features! •Supergroup CUBE and ROLLUP •VALUES in FROM clause Many new functions! •INSERT in FROM This is a BANG up release! •Expression support in Index •Row change TIMESTAMP •Hidden Columns •Full outer join •Skip locked data •For each finds its way to SPL! •Many new functions, & features. This is a bang up release! 11 Insert ->Header & Footer © All rights reserved. Zend Technologies, Inc. IBM DB2 Storage Engine for MySQL

•Makes debut in i6.1 •Creates tables •Populates data

•Shipped with Zend DBi

 http://www.zend.com/en/products/dbi/ •Supported by IBM •Redbook

 http://www.redbooks.ibm.com/abstracts/sg247705.html

12 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. Server side for PHP

•SQL Server Mode Subsystem Control Server job QSQSRVR runs in QSYSWRK by default Can change to same subsystem as application PHP application runs in QHTTPSVR Better memory control and workload partitioning •ADDENVVAR ENVVAR(QIBM_SRVRMODE_SBS) VALUE('*SAME') LEVEL(*SYS)

13 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. DB2 features IBM i7.1

Insert14 ->Header & Footer © All rights reserved. Zend Technologies, Inc. DB2 features delivered in i7.1

•Enhanced SQL & RPG integration •Greater result set support •XML Data Type •Performance Adaptive query processing Self Learning Optimization Logical file on FROM support, select omit observance •SSD and in memory DB enablement •IBM i Navigator enhancements Progress monitor, Index advisor, etc.

15 Insert ->Header & Footer © All rights reserved. Zend Technologies, Inc. PHP on IBM i

•Since PHP runs natively on IBM i Zend Server! DRDA via PASE •All features available!!!

16 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. Digging in to Key Features

Insert17 ->Header & Footer © All rights reserved. Zend Technologies, Inc. Hidden Column

•Useful for protecting sensitive data from dynamic queries •Hide a column by default •Column is still there and can be manipulated directly

CREATE TABLE ZENDDATA/EMPMAST ( NAME CHAR (20 ) NOT NULL WITH DEFAULT, CITY CHAR (20 ) NOT NULL WITH DEFAULT, STATE CHAR (2 ) NOT NULL WITH DEFAULT, SSN INT NOT NULL WITH DEFAULT IMPLICITLY HIDDEN)

18 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. Insert data…

•Must explicitly reference field on insert statement (lost sleep here, but makes sense) •Then values clause…

INSERT INTO ZENDDATA.EMPMAST (NAME, CITY, STATE, SSN) VALUES('Sheldon Cooper', 'San Jose', 'CA‘,567891234);

19 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. Let’s see…

•So using “select *” returns only the visible fields…

20 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. Hidden field

•Reference hidden field explicitly to reveal data

21 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. In PHP, why is this good

•Write dynamic routines to display data • can manage what is seen by default •But as a developer, you can still manipulate and control!

22 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. But what if I want to see this?

•Include the column in the select •Now you can see it…

23 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. MySQL for IBM i Or Zend DBi == MySQL!

Function Junction Mike Pavlak Solutions Consultant [email protected] (708) 233 5880

© All rights reserved. Zend Technologies, Inc. Agenda

• What is MySQL • Install • Access • GUI’s • DB2 Storage Engine • Q&A

| 2 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 What is MySQL?

• Most Popular and widely used Open Source Database

• Relational Database management System (RDBMS)

• Like DB2, but not, really

• Command line interface

• Many GUI utilities available to manage

| 3 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 Installation, Zend DBi

© All rights reserved. Zend Technologies, Inc. MySQL Options 1. If you have never installed MySQL or Zend DBi • Perform a clean installation of Zend DBi 2. Otherwise, if you have MySQL & no real data • Delete MySQL (Steps on next slide) 3. If you have data and are at Version 5.1.x of MySQL • Update to Zend DBI via the install process 4. Lastly, if you have data at a version 5.0.x or lower 1. Export data 2. Delete MySQL & Perform clean install of ZendDBi 3. Import your data

| 5 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 Details on deleting MySQL • Steps for a clean removal… • ENDSBS ZMYSQL OPTION(*IMMED) • DLTLIB ZMYSQL • CALL QP2TERM • rm -f /usr/local/ • rm -r -f /usr/local/mysql-5.1.50-i5os-power-64bit • rm -r -f /usr/local/mysqldata • rm -f /etc/my.cnf • rm -f /tmp/mysql.sock

| 6 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 Zend DBi Installation process • Documented at Zend.com • Option to install or update within point release • Can update 5.1.x to 5.1.y (Zend Server) • Cannot update 5.0.x to 5.1.y (Zend Core) • Download .zip from Zend.com, contains SAVF & README • Follow readme.txt in SAVF, pretty straight forward • Required LP’s are typically installed before Zend Server • A word about QSECOFR…UID = 0

| 7 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 New subsystem and daemon • ZENDDBI • ZENDDBID

| 8 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 MySQL Command Line

© All rights reserved. Zend Technologies, Inc. MySQL Monitor • MySQL has no native GUI interface (sound familiar?) • Command line accessible from QSHELL, QP2TERM, etc. • This is the natural method for accessing. • Will show you access, but not a big fan. • Fully documented at MySQL website • Many books on the subject

| 10 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 Starting MySQL Monitor • I typically use CALL QP2TERM, can use QSH, etc. • cd /usr/local/mysql/bin • The mysql> is the prompter for the monitor • Mysql –u root • Mysql –u root password=‘mikey’

| 11 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 Difference between QP2TERM and Qshell • QP2TERM is window to PASE • Cannot run IBM native programs like DB2, etc. • Qshell is a Unix like shell • Runs many things you find on Unix and IBM binaries Qshell Call QP2TERM

| 12 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 Difference between QP2TERM and Qshell • QP2TERM is window to PASE • Cannot run IBM native programs like DB2, etc. • Qshell is a Unix like shell • Runs many things you find on Unix and IBM binaries Qshell Call QP2TERM

| 13 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 MySQL to DB2 terminology

Database Library

Ta bl e Physical File / Table

Index Logical File / Index

Monitor STRSQL

| 14 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 Show

| 15 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 Set database •Use • Selects the database you will use for processing • Database is like a library, where you store tables, etc. • Typically one database per application

| 16 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 Show tables

| 17 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 Display the user table using SQL

select host, user, password from user;

• Use “quit” to end the session in the MySQL Monitor and F3 to close shell.

| 18 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 Exit •Type QUIT • Press F3 to exit shell

• But there has to be a better way… • Just like DB navigator, there’s alternatives!

| 19 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 Are there any GUI’s?

© All rights reserved. Zend Technologies, Inc. Many GUI solutions, here’s a couple…

Adminer Single PHP script Lightweight, powerful and easy to use phpMyAdmin Widely used by community Installed with Zend Server

© All rights reserved. Zend Technologies, Inc. Adminer - http://www.adminer.org/ Open source & lightweight All code in single PHP script, drop it in and go!

© All rights reserved. Zend Technologies, Inc. phpMyAdmin • Open Source PHP Project • Provides nearly every access to MySQL you might need • Installed automatically with Zend Server • Access from Zend Server Dashboard… • Documentation at http://www.phpmyadmin.net/documentation/

| 23 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 phpMyAdmin – Password management • Login with “root” profile • Create your profile • Test your profile • Change root password IMMEDIATELY (if not sooner)

| 24 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 Tour the dashboard..then on to privileges

| 25 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 Privileges • Click Add new user • Fill out details, click GO

| 26 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 Look at databases & tables • Left hand navigation • Right hand workspace • FULL CRUD capabilities • Think DFU for MySQL!

| 27 © All rights reserved. Zend Technologies, Inc. 02/04/ 10 IBM DB2 Storage Engine

© All rights reserved. Zend Technologies, Inc. Why use MySQL to store in DB2?

Many PHP applications in the open source arena Can be easily installed Modifying to access DB2 can be cumbersome & then updates? Zend DBi includes IBM DB2 Storage Engine

© All rights reserved. Zend Technologies, Inc. Architecture

© All rights reserved. Zend Technologies, Inc. How to install

From the MySQL Monitor in QSH or QP2TERM install plugin ibmdb2i soname “ha_ibmdb2i.so”; Instruction is in Install Notes for ZendDBi and IBM Redbooks

© All rights reserved. Zend Technologies, Inc. IBM DB2 Storage Engine:phpMyAdmin

Create Table, set number of fields Select storage engine

© All rights reserved. Zend Technologies, Inc. phpMyAdmin gives you the SQL!

© All rights reserved. Zend Technologies, Inc. Add records to table

© All rights reserved. Zend Technologies, Inc. What happened on the i?

Library “TEST” was created Table “EXAMPLEDB2” was created Records populated

© All rights reserved. Zend Technologies, Inc. Records, please?

STRSQL Select * from test/exampleDB2

© All rights reserved. Zend Technologies, Inc. IBM Redbook and Redpiece

Discovering MySQL Using the DB2 Storage Engine

© All rights reserved. Zend Technologies, Inc. Q&A

www.zend.com

[email protected]

Please fill out your Session Evaluation!

38 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. PHP101 Program Call

© All rights reserved. Zend Technologies, Inc. Call RPG pricing program…. • Any IBM i program object will do • Create toolkit object • Setup parameters • Call program • Display results

2 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. HTML form to get parameters

3 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. Input form, default zeros then enter data

4 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. Program call part 1 – html…

5 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. Program call part 2 - Functions

6 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. Program call part 3 – Parms, call & display

7 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. Output of the program call

• See input and output values from toolkit • Yes, values can be changed in RPG and routed back  Essentially, that is what happened to EXTEND…

8 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. Where to get more info

• HTML training  W3schools.com  Local college, continuing education, etc. • PHP training  Anywhere will work  Zend, iProDeveloper (formerly SystemiNetwork) • Get a project  Define a Proof-of-concept (POC)  Dig up something out of the backlog

9 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. Books

• Books Sam’s teach yourself PHP, MySQL and Apache All in One (4th edition) ISBN:067232976X Head First HTML with CSS and XHTML ISBN:059610197X Zend Server Doc at Zend Website IBM i Programmer’s Guide to PHP on IBM i – MC Press

10 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc. THANK YOU!!!

PHP101 - Q&A

Mike Pavlak Solution Consultant Zend Technologies [email protected]

Insert11 ->Header & Footer © All rights reserved. Zend Technologies, Inc.