Zend Server for IBM i

Add to my manuals
50 Pages

advertisement

Zend Server for IBM i | Manualzz

Die ersten 5 Schritte für den Start mit PHP auf IBM i

Jan Burkl

Solution Consultant

[email protected]

© All rights reserved. Zend Technologies, Inc.

Agenda

Einführung in PHP und seine Mitspieler

Zend Server for IBM i

Hello World

Administratives Setup

Zend Studio

PHP Data Access

2

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Agenda

Die fünf Schritte…

1.

Das PHP Universum verstehen

2.

3.

Den “Stack” auf IBM i verstehen

Zend Server installieren

4.

5.

Zend Studio installieren

Produktiv werden!

3

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

1. Das PHP Universum verstehen

© All rights reserved. Zend Technologies, Inc.

PHP ist eine Scripting Language

PHP Hypertext Pre-Processor

Ursprünglich entwickelt von Rasmus Lerdorf in 1994

PHP/FI

Zeev Suraski und Andi Gutmans partizipieren seit 1997

(ZEev + aNDi = Zend)

Interpretiert, nicht kompiliert

Nachsichtige und intuitive Code Struktur(Geringe

Lernkurve)

Direktes Feedback während Entwicklung

ähnlich zu Net.Data

5

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Wer ist Zend?

Provider einer stabilen, unterstützten PHP Distribution

Provider von kommerziellen Tools und Support von PHP

Zend Server

Zend Studio

6

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Zend und IBM

Partnerschaft seit 2005

Erneuert in 2008

Zend durch IBM ausgewählt um PHP auf IBM i zu ermöglichen

Zend Solutions pre-loaded mit IBM i 6.1 und 7.1!

Einfach das LP installieren und los geht’s!

Produkte gibt es auch weiterhin auf zend.com

© All rights reserved. Zend Technologies, Inc.

7

Start mit PHP auf IBM i

Warum Open Source?

Innovationen in besonderen ökonomischen Situationen

Geringe Einstiegskosten

Hochqualitative Applikationen

Geringer TCO

Läuft nativ auf IBM i, keine Notwendigkeit für zusätzliche

Hardware / OS

Sie benutzen es schon! (Apache, Eclipse, etc.)

Wir sind nicht die einzigen, die über Open Source sprechen…

IBM in der Februar ‘09 Edition!

http://www.ibmsystemsmag.com/ibmi

© All rights reserved. Zend Technologies, Inc.

8

Start mit PHP auf IBM i

Der “Stack”

Getestete, Business Ready Distribution von PHP (Support)

Natives Environment im PASE

Home Base für PHP Module wie GD, PEAR, etc.

Browserbasierte Admin Konsole

Zugriff direkt nach Installation

Schauen wir uns die Architektur des Stacks an

Und die Installation auf der IBM i

© All rights reserved. Zend Technologies, Inc.

9

Start mit PHP auf IBM i

2. Zend Server for IBM i

© All rights reserved. Zend Technologies, Inc.

Was ist Zend Server?

PHP Stack für die Produktion

PHP, ZF, DB Konnektivität, Debugging Extension, und mehr

Zwei Editionen - Freie “Community Edition” unterstützt durch IBM & kommerzielle

Edition

Beide sind Production Ready

Applikations-Monitoring und Diagnose

(Integration mit Zend Studio)

Multi-Level Performance Features

Software Updates und Security Hot Fixes

Einfache und schnelle Installation

Zend Framework Integration

© All rights reserved. Zend Technologies, Inc.

11

Start mit PHP auf IBM i

Zend Server for IBM i

Next Generation des PHP

Stacks für IBM i

Das Beste von Zend Core und

Zend Platform

Single Licensed Program

Installation

Zwei Produkte

Zend Server for IBM i Community

Edition

• Kostenfrei durch IBM Partnerschaft

Zend Server for IBM i

• Lizenz von Zend

• Extra Features

• Höhere Support SLAs

12

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Warum eine neue Generation?

Verbesserte Basic PHP Performance

30% bis 600% (Abhängig von der Applikation)

Neue Möglichkeiten

Applikations-Monitoring

Code Tracing – Schnellere Problemlösung

Job Queue – Performance und Skalierbarkeit

Multi-Level Caching – Performance und Skalierbarkeit

Support für PHP 5.3

Einfachere Installation, Administration und Wartung

© All rights reserved. Zend Technologies, Inc.

13

Start mit PHP auf IBM i

Zend Server unter der Haube

IBM i

ILE Apache:10088

i/OS

Default Konfiguration

FastCGI

PASE

URL Request

HTML

HTTP:10088

Server

(FastCGI)

PHP CGI

Zend Server

PHP file

*PGM

CMD

DB2 UDB

© All rights reserved. Zend Technologies, Inc.

14

Start mit PHP auf IBM i

Systemvoraussetzungen

Bitte den Installation Guide lesen !!!

Description Product Option Licensed Program

---------------------------------------------------- ----------------

Portable App Solutions Environment 33 57XXss1

Qshell 30 57XXss1

System Openness Includes 13 57XXss1

IBM Portable Utilities For I5/OS *base 5733sc1

OpenSSH ,OpenSST,Zlib 1 5733sc1

15

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

3. Zend Server installieren

© All rights reserved. Zend Technologies, Inc.

Zend Server installieren

Voraussetzungen:

Zend Server Installationshandbuch!!!

 i5/OS V5R3 Core ist noch verfügbar, Zend Server wird nicht funktionieren!

V5R4, i6.1, i7.1 (alle Zwischen-Releases)

Neuste Kumulative PTF Pakete, PASE, Qshell, Group für HTTP

Software Installation

Windows Installation oder...

Upload *SAVF, Restore, und mit dem Coden starten!

Bonus!

MySQL kann gleichzeitig installiert werden

17

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Wo bekommt man es? IBM LP oder zend.com

18

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

PHP Transaktion Lifecycle

User Request

/Review

HTML, JavaScript, etc.

Browser

HTTP/HTTPS

Apache

Sends

Output Buffer

19

Start mit PHP auf IBM i

Zend

Server PHP

PASE

© All rights reserved. Zend Technologies, Inc.

Apache

Receives

IFS Files

DB2 & Toolkit access to IBM I

Resources

Start/Stopp Zend Server, MySQL, etc...

Type GO ZENDSVR/ZSMENU, Option 5 und 1

20

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Zend Server Konfiguration

Nur zwei Screens!

 http://ibmiserver:2001 um IBM HTTP Server zu administrieren

Zend Admin um Zend/PHP Optionen zu administrieren

21

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Zend Server Port Change?

• Default Proxy zeigt auf

Port 10088

IBM Admin Server

ZENDSVR öffnen

General Server

Configuration

Apply & Neustart

22

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

02/03

/10

Beispiel Skripte

23

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

02/03

/10

Sample Scripts!

24

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Zend Server php.ini Änderungen

4. Zend Studio installieren

Server

Einloggen mit initialem

Passwort

(Reset in Green

Screen Server

Setup  Directives)

Alle Werte in php.ini verwalten

Include path ist eine von vielen Optionen

Restart PHP

© All rights reserved. Zend Technologies, Inc.

25

Start mit PHP auf IBM i

4. Zend Studio installieren

© All rights reserved. Zend Technologies, Inc.

Zend Studio 8 for IBM i

Essentielle IDE für PHP auf IBM i

Beinhaltet für IBM i Kunden 1 Jahr Support und Upgrades

Syntax Checker & Code Completion

JavaScript Library Support

Debugger

Basiert auf Eclipse Framework

Funktionen-Verzeichnis

Templates

Viel, viel mehr

© All rights reserved. Zend Technologies, Inc.

27

Start mit PHP auf IBM i

Zend Studio 8 for IBM i - Installation

Download von zend.com/de/downloads (IBM i Edition!)

Installation auf Workstation (Mac, Windows, Linux)

Dialogen für die Installation/Lizensierung folgen

IDE starten und PHP coden

28

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Wie IFS Daten bearbeiten?

Drei mögliche Methoden

Netserver (oder ein gemapptes lokales Laufwerk)

• Kann träge sein

Remote Server Konfiguration

• Beste Möglichkeit

WRKLNK

• Nur für Notfälle!

29

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Remote Server Optionen

FTP

Bekannt

Langsam

Von den meisten Systemen unterstützt

SSH

Sicherer

Mächtiger

Einfacher aufzusetzen

Einfacher aufzusetzen ab i6.1+

© All rights reserved. Zend Technologies, Inc.

30

Start mit PHP auf IBM i

Remote Server konfigurieren

Zend Studio for IBM I starten

New Connection Button SSH auswählen

Systemname oder IP Adresse angeben

31

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Navigieren zu Dateien

Dateibaum öffnen

Verzeichnis/www/zendsvr/htdocs

User Credentials eingeben

32

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

© All rights reserved. Zend Technologies, Inc.

5. Produktiv werden!

Hello World

© All rights reserved. Zend Technologies, Inc.

Beispiel Skript – Hello World

Obligatorisches Programm

Bestätigt korrektes PHP Setup

Beispielcode: Kürzestes PHP Makro

Skript in IFS speichern:

/www/zendsvr/htdocs/helloworld.php

Browser URL: http://ibmisystem:10088/helloworld.php

<?php

echo "Hello World" ;

?>

© All rights reserved. Zend Technologies, Inc.

35

Start mit PHP auf IBM i

36

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

i5 Toolkit APIs

System values

 i5_get_system_value

Data areas

 i5_data_area_prepare i5_data_area_receive i5_data_area_send i5_data_area_close

Print/Get spooled file

 i5_spool_list i5_spool_list_read i5_spool_list_close i5_spool_get_data

Job logs

 i5_jobLog_list i5_jobLog_list_read i5_jobLog_list_close

Active jobs

 i5_job_list i5_job_list_read i5_job_list_close

Objects list

 i5_object_list i5_object_list_read i5_object_list_close

User space

 i5_userspace_create

 i5_userspace_prepare

 i5_userspace_get

 i5_userspace_put

Programs

 i5_program_prepare

I5_program_call

© All rights reserved. Zend Technologies, Inc.

37

Start mit PHP auf IBM i

Open Source Toolkit

Kollaboration von IBM und Zend

Gebaut auf ILE RPG, Stored Procedures und reinem PHP

Bis zu 10x schneller

Objektorientiert, aber nicht zu viel

38

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Beispiel: Toolkit Funktionen

<?php

$ToolkitObj =

new ToolkitService();

$ToolkitObj->setToolkitServiceParams(

array ( 'ControlKey' => '*here' , 'Internal key' => '/tmp/QAUser' ));

$ToolkitObj->CLCommand( 'addlible test' , 'b' );

/* Call a program without parameters */

$ToolkitObj->PgmCall( 'TESTPGM' , 'TESTLIB' ,

array (0), NULL , NULL );

/* Call srvc program function 'sum' which has 3 parms: 2 int input parms and 1 output parm */

$params[] =

array ( 'type' => '10i0' , 'io' => 'in' , 'parm_name' => 'first' , 100);

/*first input parm */

$params[] = AddParameterInt ( 'in' , 10, 'second' , 200); /*second input parameter */

$params[] = AddParameterInt ( 'out' , 10, 'third' , 0); /*third output parameter*/

$Result = $ToolkitObj->PgmCall( 'TESTSRVPGM' ,

NULL , $Params, NULL , array ( 'func' , 'sum' ));

var_dump($result ); //$result[0]

/*execute function again with a new data */

$ToolkitObj->SetParamValue($Params, 'first' , 20); /* reset value of first parameter*/

$ToolkitObj->SetParamValue($Params, 'second' , 30); /* reset value of second parameter*/

$ToolkitObj->PgmCall( 'TESTSRVPGM' ,

NULL , $Params, NULL , array ( 'func' , 'sum' ));

$ToolkitObj->disconnect();

?>

© All rights reserved. Zend Technologies, Inc.

39

Start mit PHP auf IBM i

PHP Data Access Beispiel

© All rights reserved. Zend Technologies, Inc.

Einfaches Listing eines Files

Zur DB2 verbinden

Select Records von einer DB2 Tabelle

Records in eine HTML Tabelle laden

Output anzeigen

41

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Verbindung zur DB2

Drei Dinge benötigt:

System

User ID

Password

Wenn Ihre Data Sets *PUBLIC Zugriff haben, wird Username und Passwort nicht benötigt

<?php

// Standard DB connection to DB2...

$conn = "*LOCAL" ; $name = "" ; $pwd = "" ;

$i5link = db2_connect($conn, $name, $pwd);

if (!$i5link) echo 'Connection failed: ' .db2_stmt_error().

' : ' .db2_stmt_errormsg();

$sql = "SELECT * from zenddata.customer" ;

$stmt = db2_exec($i5link,$sql) or

die ( "Failed query:" .db2_stmt_error().

":" .db2_stmt_errormsg());

?>

42

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Daten lesen...

< h1 > Customer list for a company </ h1 >

< table border =

"10"

bordercolor = "blue"

>

< tbody bgcolor =

"#deb887" >

< tr >

< td > Customer Number </ td >

< td > Customer Name </ td >

< td > Address Line 1 </ td >

< td > Address Line 2 </ td >

< td > City </ td >

< td > State </ td >

< td > Zip Code </ td >

</ tr >

43

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Daten lesen...

<?php

while ($row = db2_fetch_array($stmt)) : list (

$CUSTOMER_NUMBER, $CUSTOMER_NAME, $CUSTOMER_ADDRESS_LINE1,

$CUSTOMER_ADDRESS_LINE2, $CUSTOMER_CITY, $CUSTOMER_STATE,

$CUSTOMER_ZIP) = $row;

?>

< tr >

< td > <?php

echo $CUSTOMER_NUMBER ?> </ td >

< td > <?php

echo $CUSTOMER_NAME ?> </ td >

< td > <?php

echo $CUSTOMER_ADDRESS_LINE1 ?> </ td >

< td > <?php

echo $CUSTOMER_ADDRESS_LINE2 ?> </ td >

< td > <?php

echo $CUSTOMER_CITY ?> </ td >

< td > <?php

echo $CUSTOMER_STATE ?> </ td >

<?php

endwhile ;

?>

< td > <?php

echo $CUSTOMER_ZIP ?> </ td >

</ tr >

© All rights reserved. Zend Technologies, Inc.

44

Start mit PHP auf IBM i

Daten lesen...

</ tbody >

</ table >

<?php

db2_close($i5link);

?>

45

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Start mit PHP auf IBM i

© All rights reserved. Zend Technologies, Inc.

Was kommt als nächstes?

HTML Training

HTML ist zu PHP, was DDS zu RPG ist

JavaScript tut nicht weh

Nicht notwendig, kann aber eine Webseite aufpeppen

Freien Code downloaden

Spielen, Spaß haben, entdecken

Trainings, zend.com/de/services/training/

Üben, üben, üben!

© All rights reserved. Zend Technologies, Inc.

47

Start mit PHP auf IBM i

PHP Resources…

Books

Head First HTML with CSS and XHTML ISBN:059610197X

Zend Server Doc auf Zend Website

IBM i Programmer’s Guide to PHP on IBM i – MC Press

© All rights reserved. Zend Technologies, Inc.

48

Start mit PHP auf IBM i

Online Ressourcen

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 – Freie Applikationen

 phpclasses.org – Freie PHP Code Beispiele

 hotscripts.com – Freier PHP Code

© All rights reserved. Zend Technologies, Inc.

49

Start mit PHP auf IBM i

Dankeschön!

[email protected]

© All rights reserved. Zend Technologies, Inc.

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals

Download PDF

advertisement