© All rights reserved. Zend Technologies, Inc.
Mike Pavlak
Solutions Consultant
[email protected]
Function Junction
PHP in the Enterprise
Agenda
•
Market analysis
•
Evolution of PHP and IBM i
•
PHP stacks up today
•
PHP in the IBM i Enterprise
•
Development Community
•
Mobile
© All rights reserved. Zend Technologies, Inc.
PHP in the Enterprise
www.zend.com
CLOUD & MOBILE USAGE is a now a core design point
72%
of PHP Developers
are using cloud based
services & APIs
2/3
of PHP developers
expect to work on
mobile apps in 2012
63%
of developers are
creating apps for
cloud deployment
Market Overview
With a community of over 5 million developers, PHP usage has significantly
broadened in recent years
What type of application(s) have you built with PHP?
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
Functions of PHP apps have become diverse
60%
of PHP apps
are developed for
© All rights reserved. Zend Technologies, Inc.
Key Trends in PHP
What Is Fueling this Enterprise Adoption?
Software
•
Complexity of other web
languages (Java, .Net, etc.)
•
PHP’s comparative ease of use
•
Web application re-engineering
of n-tiered applications
•
Price/performance
•
TCO
•
Enterprise-readiness of PHP
driven by Zend
Hardware
•
Server consolidation
•
Front-ending web applications to
host data
•
Manageability
•
Price/performance
© All rights reserved. Zend Technologies, Inc.
Zend Has Driven Dynamics of Making PHP
Enterprise Ready
Enterprise
Tooling via
Eclipse
Web
Application
Server
Strategic
Platforms
Integrations
Zend
Framework
Enterprise PHP
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
© All rights reserved. Zend Technologies, Inc.
Research shows that expansion has been driven by benefits in speed of
development and ease of working with the cloud
Market Overview
What are the main reasons you choose to
develop in PHP?
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
Compared with your next most-used language, is
PHP better or worse at each of the following?
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
PHP in the Enterprise
www.zend.com
© 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
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
A Great Year for Zend in the Cloud
9
Growth in
Zend
Developer
Cloud Users
Q4 2011
Q1 2012
Q2 2012
Q3 2012
Expanded IBM
Partnership to
MySQL
PHP in the Enterprise
www.zend.com
© All rights reserved. Zend Technologies, Inc.
Top 10 Internet Sites by WW traffic
15
2. Google.com
4. Yahoo.com
3. Youtube.com
5. Baidu.com
1. Facebook.com
8. Amazon.com
9. qq.com
6. Wikipedia.com
7. Live.com
10. Twitter.com
Jan 2013
5 more
in next
10
Enterprise PHP Adoption is Growing Rapidly
“Commercial and corporate IT
developers will account for more
than 2 million PHP community
members—growing from 20% to
50% of the worldwide PHP
developer population.”
PHP
Developers
2009
2014
Commercial and corporate IT developers
5M
4M
3M
2M
1M
Non-commercial developers
© 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 php, html, etc running on apache using
db2 via odbc. It has taken us to new levels ...”
© All rights reserved. Zend Technologies, Inc.
PHP in the Enterprise
www.zend.com
HTML
C L I E N T
“Mobile 0.5” – First-Gen Mobile Apps
•
“Dumbed-down” web interface
•
Limited, “as is” desktop to
mobile device
•
UI = server based
B A C K - E N D S Y S T E M S
APIs
Today’s Mobile Apps
Enterprise systems and data sources
•
Native apps
•
Too many devices to support
•
Server-side APIs “hacked”
into existing systems
“Mobile First” Approach
Pervasive Reach
Context is All
Touch vs. QWERTY
Users:
The Future – Cloud-Connected Mobile Apps
B A C K - E N D S Y S T E M S
•
Provide services to clients
•
Composite architecture
•
Elastic scaling
Web-driven native experience
M O B I L E C L I E N T S
Cloud Services
Architecture
APIs
S O C I A L A N D S A A S
PHP in the Enterprise
www.zend.com
© 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/
201
3
Why PHP on i?
Leverage Existing
Infrastructure to
Develop & Run Dynamic
Web Applications Easily
•
Powerful , Flexible, & Fastest Growing Web
Development Language
•
Native on IBM i/OS
•
Backing & Support of IBM
•
Controlled/Driven by PHP Community
•
Easy to Use & Fast to Deploy
•
Supports Heterogeneous Environments
•
Powerful Integration Capabilities
Application Modernization
Use PHP to web-enable green screen
applications, utilizing existing data &
business logic without rewriting
application
Consolidate Data in
DB2/400
Move PHP applications that are
running on Windows or Linux
that access data in DB2 to run
in IBM i/OS to speed up or
reduce complexity of the
applications
New/Packaged Web
Application on IBM i/OS
Create new applications with PHP on
IBM i/OS or leverage thousands of
existing Open Sources applications
Access RPG
Programs & Data as
Web Services
Package programs and data as
web services and make
available to other web
applications
Access DB2/400 Data
via Browser
Easily access and interact with
DB2/400 data using a standard
© All rights reserved. Zend Technologies, Inc.
Zend commitment to IBM i
•
Zend Server 6
Q1-2013
•
Zend Studio 10
Q1-2013
•
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
Both in beta
right now!
What are you doing?
•
Pick an application and say…
© 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
© All rights reserved. Zend Technologies, Inc.
Advanced Functions with
DB2 and PHP for IBM i
Mike Pavlak
Agenda
•
DB2 features in V5R4, i6.1 and i7.1
•
Review DB2 functions in PHP
•
Explore the possibilities
© All rights reserved. Zend Technologies, Inc.
Three primary ingredients to PHP script
© 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
Subscribe to blog and get notified!
© All rights reserved. Zend Technologies, Inc.
DB2 features V5R4
7
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.
© 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!
© All rights reserved. Zend Technologies, Inc.
Lots of new features!
•
Supergroup
CUBE and ROLLUP
•
VALUES in FROM clause
•
INSERT in FROM
•
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 & FooterMany new
functions!
This is a BANG
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
© 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)
© 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.
PHP on IBM i
•
Since PHP runs natively on IBM i
Zend Server!
DRDA via PASE
© All rights reserved. Zend Technologies, Inc.
Digging in to Key Features
17
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,
© All rights reserved. Zend Technologies, Inc.
Insert data…
•
Must explicitly reference field on insert statement
(lost sleep here, but makes sense)
•
Then values clause…
19
Insert->Header & FooterINSERT INTO
ZENDDATA.EMPMAST (NAME, CITY, STATE,
SSN
)
Let’s see…
© All rights reserved. Zend Technologies, Inc.
Hidden field
•
Reference hidden field explicitly to reveal data
In PHP, why is this good
•
Write dynamic routines to display data
•
Database can manage what is seen by default
© 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…
Mike Pavlak
Solutions Consultant
[email protected]
(708) 233 5880
Function Junction
MySQL for IBM i
Or
© All rights reserved. Zend Technologies, Inc.
Agenda
•
What is MySQL
•
Install
•
Access
•
GUI’s
•
DB2 Storage Engine
•
Q&A
| 2
02/04/
10
© All rights reserved. Zend Technologies, Inc.
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
© All rights reserved. Zend Technologies, Inc.
© 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
© All rights reserved. Zend Technologies, Inc.
Details on deleting MySQL
•
Steps for a clean removal…
•
ENDSBS ZMYSQL OPTION(*IMMED)
•
DLTLIB ZMYSQL
•
CALL QP2TERM
•
rm -f /usr/local/mysql
•
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
02/04/
10
© All rights reserved. Zend Technologies, Inc.
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
© All rights reserved. Zend Technologies, Inc.
New subsystem and daemon
•
ZENDDBI
•
ZENDDBID
| 8
02/04/
© 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
02/04/
© All rights reserved. Zend Technologies, Inc.
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’
© All rights reserved. Zend Technologies, Inc.
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
| 12
02/04/
10
© All rights reserved. Zend Technologies, Inc.
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
| 13
02/04/
© All rights reserved. Zend Technologies, Inc.
MySQL to DB2 terminology
| 14
02/04/
10
Database
Library
Table
Physical
File / Table
Index
Logical File
/ Index
Monitor
© All rights reserved. Zend Technologies, Inc.
Show databases
© All rights reserved. Zend Technologies, Inc.
Set database
•
Use <DBNAME>
•
Selects the database you will use for processing
•
Database is like a library, where you store
tables, etc.
•
Typically one database per application
| 16
02/04/
© All rights reserved. Zend Technologies, Inc.
Show tables
© All rights reserved. Zend Technologies, Inc.
Display the user table using SQL
| 18
02/04/
10
select host, user, password from user;
© All rights reserved. Zend Technologies, Inc.
Exit
•
Type QUIT
•
Press F3 to exit shell
•
But there has to be a better way…
•
Just like DB navigator, there’s alternatives!
© 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 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/
© All rights reserved. Zend Technologies, Inc.
phpMyAdmin – Password management
•
Login with “root” profile
•
Create your profile
•
Test your profile
•
Change root password
IMMEDIATELY (if not sooner)
| 24
02/04/
© All rights reserved. Zend Technologies, Inc.
Tour the dashboard..then on to privileges
© All rights reserved. Zend Technologies, Inc.
Privileges
•
Click Add new user
•
Fill out details, click GO
| 26
02/04/
© All rights reserved. Zend Technologies, Inc.
Look at databases & tables
•
Left hand navigation
•
Right hand workspace
•
FULL CRUD capabilities
•
Think DFU for MySQL!
© All rights reserved. Zend Technologies, Inc.
IBM DB2 Storage
Engine
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
How to install
From the MySQL Monitor in QSH or QP2TERM
install plugin ibmdb2i soname “ha_ibmdb2i.so”;
© 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.
Add records to table
What happened on the i?
Library “TEST” was created
Table “EXAMPLEDB2” was created
Records populated
© All rights reserved. Zend Technologies, Inc.
Records, please?
STRSQL
IBM Redbook and Redpiece
© All rights reserved. Zend Technologies, Inc.
38
Insert->Header & Footer
Q&A
www.zend.com
[email protected]
Please fill out your
Session Evaluation!
PHP101
© 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
© All rights reserved. Zend Technologies, Inc.
Input form, default zeros then enter data
© All rights reserved. Zend Technologies, Inc.
Program call part 2 - Functions
© 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…
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)
© All rights reserved. Zend Technologies, Inc.