getting started with php on ibm i

61
Getting started with PHP on IBM i Mike Pavlak Solution Consultant [email protected]

Upload: zend-by-rogue-wave-software

Post on 15-Jan-2017

217 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Getting started with PHP on IBM i

Getting started with PHP on IBM iMike PavlakSolution [email protected]

Page 2: Getting started with PHP on IBM i

3

Audience

• Are you looking to learn more about the what & how of PHP on IBM i?

• Have you done some PHP but new to IBM i?• Are you already doing PHP but Looking for

product refresh?• Might you be looking to grow beyond PDM/RPG?

Page 3: Getting started with PHP on IBM i

4

Agenda

• The Five Steps…1. Understand the PHP universe2. Understand the “stack” on IBM i 3. Install Zend Server4. Install Zend Studio5. Get productive!

Page 4: Getting started with PHP on IBM i

Getting started with PHP and IBM iUnderstand the PHP universe

Page 5: Getting started with PHP on IBM i

6

PHP is a scripting language• PHP Hypertext Pre-Processor• Developed initially by Rasmus Lerdorf in 1994: PHP/FI• Zeev Suraski and Andi Gutmans Contributing since1997+ (ZEev +

aNDi = Zend)• Interpreted, not compiled• Forgiving and intuitive code structure (short learning curve)• Immediate feedback during development• PHP is to Java what RPG is to COBOL

Page 6: Getting started with PHP on IBM i

7

Who is Zend?

• Major contributor to PHP (4 FTE’s contribute to Open Source)• Providers of supported PHP distribution, Zend Server• Providers of commercial tooling for PHP, Zend Studio, Guard

Page 7: Getting started with PHP on IBM i

8

Zend and IBM

• Partnership began in 2005• Zend selected by IBM to deliver PHP on IBM i• Zend solutions shipped with IBM i 7.1, 7.2 and 7.3! • Just install the LP and go!• Most current distributions and updates at Zend.com• Relationship expanded in 2012 to include MySQL (Maria

coming soon)

Page 8: Getting started with PHP on IBM i

9

What do we get?• Thanks to our partnership with IBM, each IBM i customer under

SWMA can take advantage of these Zend solutions:– Zend Server for IBM i basic edition

– Runs natively on IBM i as a licensed program– Zend Studio for IBM i

– IDE runs on desktop for creating PHP scripts– One year of updates and support.– Studio is a perpetual license while Server will need to be

annually renewed via Zend Sales support

Page 9: Getting started with PHP on IBM i

10

The “Stack”• Tested, business ready and supported distribution of PHP • Runs in Native Environment under PASE, no LPAR needed • Home base for PHP modules like GD, PEAR, etc.• Browser based admin console (10081)• Accessible immediately after install• Let’s look at the architecture of the stack• And then installation on IBM i • No charge LP Included with system maintenance

Page 10: Getting started with PHP on IBM i

11

Polling Question #1 (check all that apply)What would you like to modernize?

1. Green screen ERP, etc. to GUI

2. Mobile

3. Business intelligence/data mining/reporting

4. Customer/supplier self service

5. Collaboration

6. Other

7. No needs, yet

Page 11: Getting started with PHP on IBM i

Getting Started with PHP and IBM iZend Server for IBM i

Page 12: Getting started with PHP on IBM i

13

Help Systems Survey 2016

Page 13: Getting started with PHP on IBM i

14

What Is Zend Server?• Production quality PHP stack

– PHP, ZF, DB connectivity, debugging extension, and more

• Three Editions – No charge “Basic Edition” provided by IBM & Full Professional and Enterprise commercial edition – All are production ready

• Application monitoring and diagnostics (integrated with Zend Studio)

• Multi-level performance enhancement capabilities

• Software updates and security hot fixes• Easy and quick installation • Zend Framework Integration

Page 14: Getting started with PHP on IBM i

15

Zend Server

Zend Server Under the Covers

HTTP:10080ApacheServer(FastCGI)

IBM i

i/OS

DB2 UDB

PHP CGI

PHP filePASE

*PGM

CMD

ILE Apache:10080• Default

configuration FastCGI

URL Request

HTML/response

MySQL, SQL Server,

Oracle

Thanks Tony!

Page 15: Getting started with PHP on IBM i

Getting started with PHP and IBM iInstalling Zend Server

Page 16: Getting started with PHP on IBM i

17

Software Pre-req's

Description Product Option Licensed Program-------------------------------------- --------------- ----------------Portable App Solutions Environment 33 57XXss1Qshell 30 57XXss1System Openness Includes 13 57XXss1IBM Portable Utilities For I5/OS *base 5733sc1OpenSSH ,OpenSST,Zlib 1 5733sc1

Please read the Installation Guide !!!

Make sure they match your release! Except 7.3

Page 17: Getting started with PHP on IBM i

18

Install Zend Server• Prerequisites:

– See Zend Server installation documentation for LP’s! – Supported releases: i7.1, i7.2 and i7.3– Recent Cumulative PTF package, PASE, Qshell, Group for HTTP

• Software installation– Logon with *SECOFR authority (QSECOFR for MySQL for best

results)– Upload *SAVF, Restore, and start coding!– Clean installation can start the stack automatically

• Bonus ZendDBi– MySQL 5.1 can be installed at the same time or later

Page 18: Getting started with PHP on IBM i

19

Best place to get it: Zend.com http://www.zend.com/en/products/server/downloads#IBM%20i

Page 19: Getting started with PHP on IBM i

20

Updates on same page, scroll down…https://www.zend.com/en/products/server/downloads#IBM%20i

Page 20: Getting started with PHP on IBM i

21

Polling Question #2What version of PHP are you running?

1. PHP 5.2 (Zend Core, Zend Server 5)

2. PHP 5.3 (Zend Server 5-6)

3. PHP 5.4 (Zend Server 7)

4. PHP 5.5 (Zend Server 7-8)

5. PHP 5.6 (Zend Server 8)

6. Not running PHP, yet

Page 21: Getting started with PHP on IBM i

22

Why older versions?• Simple, Long Term Support

Page 22: Getting started with PHP on IBM i

23

Start/stop Zend Server, MySQL, etc... Type GO ZENDSVR6/ZSMENU, Option 5 then 1

Page 23: Getting started with PHP on IBM i

24

Zend Server Configuration• Only two interfaces!

– Use http://ibmiserver:2001 to administer IBM HTTP server

– Use Zend Admin for Zend/PHP options http://ibmiserver:10081

Page 24: Getting started with PHP on IBM i

25

Zend Server Port Change?• Default proxy points

to Port 10080– Log in to IBM Admin

Server and open up ZENDSVR6

– Go to General Server Configuration

– Click Apply & restart the server

Copyright © 2009 Zend Technologies, Inc, All rights reserved 02/03/10

| 25

Page 25: Getting started with PHP on IBM i

26

Deploy samples and demo• Click guide page & scroll down to XML Toolkit• Click link to install XML Toolkit demo application to deploy

samples…• Simple wizard, accept default, enter path and go…

Page 26: Getting started with PHP on IBM i

27

Sample Scripts! (http://IBMi:10080/samples)

Page 27: Getting started with PHP on IBM i

28

Z-Ray for 30 days!• Firebug for PHP!

Page 28: Getting started with PHP on IBM i

29

Zend Server php.ini changesManage php.ini via GUI in Zend Server

• Log in with initial password, can reset in green screen Server Setup Directives

• Administer all values in php.ini• Include path is one of over 400 options

Page 29: Getting started with PHP on IBM i

30

Zend Support• Included with Basic edition for 1 year• Upgraded support (phone) can be purchased from

Zend• Support contract includes productivity tools and Z-

Ray!• Log in to My Zend at zend.com

Page 30: Getting started with PHP on IBM i

Getting started with PHP and IBM iInstall Zend Studio

Page 31: Getting started with PHP on IBM i

32

Zend Studio 13.5 for all!• Included for IBM i customers w/1 year support & upgrades• Essential IDE for PHP on IBM i• Syntax checker & code Completion• JavaScript Library Support• Debugger• Built on Eclipse framework• Function directory• Templates• Much, much, more

Page 32: Getting started with PHP on IBM i

33

Zend Studio - Installation• Download program from Zend.com (Not shipped with OS)• Install to workstation (Mac, Windows, Linux)• Follow the prompts for licensing the product, QSRLNBR

Page 33: Getting started with PHP on IBM i

34

Remote Server Options

• FTP– Familiar– Sluggish– Most systems support this, but potentially dangerous

• SSH– More secure– More powerful– Easy to setup– Easier to setup on i6.1+

Page 34: Getting started with PHP on IBM i

35

Configuring a remote server• Start Zend Studio & open “Remote Systems” window

• Windowshow viewRemote Systems

• Click the new connection button and select SSH

• Enter system name or IP address

Page 35: Getting started with PHP on IBM i

36

Navigate to files• Expand the tree for your system (triangle twisties)• Enter user credentials and your in!• Navigate to the directory /www/zendsvr6/htdocs

Page 36: Getting started with PHP on IBM i

38|

Page 37: Getting started with PHP on IBM i

Getting started with PHP and IBM iGet Productive

Page 38: Getting started with PHP on IBM i

40

Sample Script – Hello World• Obligatory program when starting out• Confirms correct setup of PHP• Sample code: (Shortest PHP Macro around!)• Save script in IFS /www/zendsvr6/htdocs/helloworld.php• Browser URL: http://ibmisystem:10080/helloworld.php

Page 39: Getting started with PHP on IBM i

41

Page 40: Getting started with PHP on IBM i

42

Open Source Toolkit– Collaborative project with IBM and Zend– Built using ILE RPG, Stored procedures and PHP– Object Oriented, but not too much

Set parameters based on function

Call program

Output results

I/O

Length

Comment

Var name

Init val

Page 41: Getting started with PHP on IBM i

Getting started with PHP and IBM iDB2 data access example

Page 42: Getting started with PHP on IBM i

46

Build on our example• In a static HTML page we would hard code a list of values

Page 43: Getting started with PHP on IBM i

47

Build on our exampleIn a static HTML page we would hard code a list of values

Page 44: Getting started with PHP on IBM i

50

First connect to DB2

Page 45: Getting started with PHP on IBM i

51

Then run SQL

Page 46: Getting started with PHP on IBM i

52

Table detail replaced

Page 47: Getting started with PHP on IBM i

53

Page looks eerily familiar…

After

Before

Page 48: Getting started with PHP on IBM i

54

Html output (right-click, view source)

Page 49: Getting started with PHP on IBM i

55

What happened to the last name?

• Changed from bgcolor to class?

Page 50: Getting started with PHP on IBM i

56

CSS Class added• Class starts with period• Links attributes in external file to page• Nearly any element can modify page• Good practice, even for single element• Studio will highlight bad practices

Page 51: Getting started with PHP on IBM i

57

Common questions on data access• Library list support?

– Single, multiple, job description• Hard coded user id and password

– Yes, no, maybe---You don’t have to!• HTML and Data Access, etc.

– MVC and organize your code• Get started doing something!!!

02/03/10

Page 52: Getting started with PHP on IBM i

58

Demo timeJump out and review

Page 53: Getting started with PHP on IBM i

Getting started with PHP and IBM iWrap it up!

Page 54: Getting started with PHP on IBM i

60

Where do I go next?

• Get some HTML5 & CSS training– Remember, HTML is to PHP what DDS is to RPG

• JavaScript for grids, etc.– Can add pizzazz to web pages, but not required

• Download free code – see online resource slide• Play, have fun, discover• Education, training more See zend.com• Practice, practice, practice!

02/03/10

Page 55: Getting started with PHP on IBM i

61

IBM Redbook SG24-8185• Application Modernization

• Tons of great info for…

– DB2

– RPG

– More…

• Chapter 12 by yours truly

• Exhibits same code as

– In line PHP

– Procedural

– Object Oriented

02/03/10

Page 56: Getting started with PHP on IBM i

62

PHP Resources…

Books• Sam’s teach yourself PHP, MySQL and Apache All in One (5th

edition) ISBN:0672335433 • 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

02/03/10

Page 57: Getting started with PHP on IBM i

ATTENDBecome a PHP authority.Connect with experts.Register now.

SPEAKShare, inspire, educate.CFP open until May 31.

SPONSORSpotlight your best in enterprise [email protected]

Visit zendcon.com

Page 58: Getting started with PHP on IBM i

64

Online Resources…• Support?

– Zend.com/forums– Zend.com/support-center– Zend.com/products– php.net – on-line PHP manual– Midrange.com WEB400 forum

• Free code!– Sourceforge.net – free applications– phpclasses.org – free PHP code samples– hotscripts.com – free PHP code

02/03/10

Page 59: Getting started with PHP on IBM i

65

Polling Question #3Did this webinar help?

1.Yes, Can’t wait to move forward with PHP

2.Still evaluating, but will look at PHP

3.Still evaluating but not PHP

4.Not much help

Page 60: Getting started with PHP on IBM i

66

Get a jump start on PHP 7

PHP 7 Jump Start – Online Training Course

August 22, 2016-------------------------------

$299US

REGISTER @ www.zend.com