• No results found

WebSmart PHP USER GUIDE

N/A
N/A
Protected

Academic year: 2021

Share "WebSmart PHP USER GUIDE"

Copied!
274
0
0

Loading.... (view fulltext now)

Full text

(1)

USER GUIDE

Software Version 2.0. User Guide Build 3. For iSeries, Windows 98+, XP and Vista Edition.

®

WebSmart

PHP

WebSmart PHP is tightly integrated with the System i and includes

templates & wizards to guide you through creating PHP applications.

Exclusive Distribution Rights:

Business Computer Design International, Inc.

950 York Road

Hinsdale IL, 60521 USA Phone: 630-986-0800 Fax: 630-986-0926

E-Mail: [email protected] Web: www.bcdsoftware.com

Software Development and Technical Support:

ExcelSystems Software Development, Inc.

101-9724 Fourth Street Sidney, BC Canada V8L 2Y7 Phone: 250-655-1766 Fax: 250-655-1733

E-Mail: [email protected] Web: www.bcdsoftware.com

(2)

BCD

Copyright Notice

WebSmart is a Registered Trademark of ESDI in the United States and Canada, Trademark in the rest of the world. Program © 2000-2008 ExcelSystems Software Development Inc. (ESDI). All rights reserved. Exclusive distribution rights Business Computer Design International, Inc. (BCDII)

The WebSmart PHP 2.0 User Guide is written and produced by ESDI using Adobe FrameMaker 7.0. Copyright © 2000-2008. ESDI. All rights reserved. This document many not, in whole or part, be copied, photocopied, reproduced, translated, or reduced to any electronic medium or machine readable form without written consent from ESDI.

Conventions

In this guide the term ‘iSeries’ is used to refer to the System i, i5, eServer i5, iSeries and AS/400 computer systems.

System Requirements

WebSmart PHP programs can run different platforms. On the iSeries, WebSmart PHP requires a minimum OS/400 release level of V5R3 with Zend Core 2.0 or higher installed. The i5 prerequisite programs are listed at http://www.zend.com/support/

knowledgebase.php?kbid=232. If you are hosting WebSmart PHP applications on a server other than a System i (i.e Windows, Unix, Linux), you must have Apache and PHP and all appropriate modules installed and configured correctly and you must ensure that your PHP installation can access the database(s) you need to connect to. If you are using a database for which there are predefined templates you should be able to create functional PHP applications for your environment without needing to make changes to the templates. Otherwise, varying degrees of template modifications may be required. Access to a System i is necessary during development for security purposes (but not at run-time).

You also need to have TCP/IP and the IBM HTTP Server (Powered by Apache) correctly configured. WebSmart will initially occupy approximately 50 MB on your iSeries, and up to 150 MB at times during the install and until the install libraries are removed from your system. After the install you can manually remove the library XL_WEBINST, if found.

WebSmart will run on any PC running at least Windows 98, with IE 4 installed. The minimum recommended processor speed is a Pentium 200. Note that it will run fine on slower machines, just slower!

WebSmart ILE and WebSmart PHP

WebSmart ILE generates ILE-CGI code. WebSmart PHP is used to create and edit PHP programs. Both types of program are created from the same IDE (Integrated Development Environment).

Acknowledgments

Throughout this manual, reference is made to several trademarks: ProGen WebSmart, WebSmart and ProGen Plus are registered trademarks of ESDI in the US and Canada, trademarks elsewhere in the world. Clover, Catapult, Spool-Explorer/400, Spool-Explorer, POLCMD and Exodus are trademarks of ESDI. IBM, System i, AS/400, iSeries and OS/400 are either registered trademarks or trademarks of International Business Machines in the United States and/or other countries. Windows® and Excel® are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Adobe®, Acrobat®, Flash® and Macromedia® are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries. All other trademarks are acknowledged as the properties of their respective owners.

Printed in Canada.

(3)

About this Manual 3

About the WebSmart PHP User Guide

This is the WebSmart PHP User Guide. This guide includes instructions for getting started with the software as quickly as possible, as well as reference information for using the product on a daily basis.

This guide includes the following:

An overview of WebSmart PHP, including comparisons between the ILE and

PHP versions of WebSmart, and between WebSmart PHP and other PHP editors.

Installation and configuration instructions.

An overview of some general WebSmart concepts, as well as other concepts that

you should be familiar with when designing and building web applications.

Tutorial exercises to introduce you to the product.

A reference section describing the WebSmart IDE options for WebSmart PHP,

the WebSmart program templates and the template wizard design options.

WebSmart Online Resources and Teaching Tools

In addition to the information available in this guide, you should also visit our web site to review the tools available online. Our web site, at www.bcdsoftware.com, includes these useful resources, among many others:

Over 150 example programs illustrating various PML, PHP, HTML and

JavaScript coding techniques. The programs include working examples, detailed explanations and downloadable definitions.

Hundreds of online Knowledge Base entries. These address a wide variety of

challenges and difficulties encountered by the Technical Support team over the last several years. Use the Knowledge Base search to find KB entries on error codes, programming techniques and reported problems.

Case studies and stories from customers and business partners on how they

have used WebSmart in many different situations within a wide variety of organizations.

A Flash product overview and other audio and video resources.

There are many other useful resources online that are regularly updated, so take a few minutes to visit the site, you’ll find the information available to be very helpful.

Using the PDF Version of the Documentation

This guide has been designed to be used as either a printed manual or as a PDF. There are a few differences between the two formats:

The printed manual may be updated somewhat less frequently than the PDF,

usually only in conjunction with significant new versions of the software. The PDF version may be updated as new features are added or changes are made to

(4)

4 About this Manual

existing features. The software release and document build number inside the cover will tell you what version you have.

The printed manual is black and white. In the PDF version, the screen shots are

in color and the PHP and HTML code samples are also color coded as you would see them in the product.

In the PDF version you can click on chapter and section cross references and

URLs. These are set up to be active hyperlinks.

And finally, as you use this guide to learn to use WebSmart, you can copy and

paste sample HTML and PHP code from the PDF version to your WebSmart definitions. To copy content from an Adobe PDF document, click on the Text Select Tool icon in your toolbar, then highlight the sections you want to copy, and type Ctl+C. Then go to the target location and type Ctl+V to paste in the text. It is also theoretically possible to cut and paste sections from the printed guide, but you will likely find that less effective.

If you have any questions on how to use the documentation, please phone our support group at (250) 655-1766 [7:30 AM - 5:00 PM PST], or contact us by email at

(5)

Table of Contents 5

Table of Contents

SECTION I

I

NTRODUCTION

AND

I

NSTALLATION

I

NSTRUCTIONS

Chapter 1

AN INTRODUCTION TO WEBSMART . . . 13

What is WebSmart? . . . 13

WebSmart ILE and WebSmart PHP . . . 15

WebSmart ILE Runtime Model . . . 15

WebSmart PHP Runtime Model . . . 16

Comparing WebSmart ILE and PHP . . . 17

WebSmart PHP vs. Other PHP Editors . . . 19

WebSmart and Clover . . . 22

How Should I Get Started? . . . 23

Chapter 2

INSTALLATION AND CONFIGURATION . . . 27

Step 1: End the EXODUS Subsystem. . . 28

Step 2: Install Zend Core. . . 29

Step 3: Install the WebSmart iSeries Components. . . 30

Step 4: Install the WebSmart PC Component.. . . 32

Step 5: Configure the WebSmart IDE to Connect to the iSeries. . . . 33

Step 6: Create an FTP Connection. . . 35

Step 7: Create an ODBC Connection. . . 37

Step 8: Set a Default User Profile for WebSmart PHP Programs.. . . 38

Moving On . . . 39

Installation and Configuration Troubleshooting Suggestions . . . 39

More About the WebSmart IBM HTTP Server (Powered by Apache) Instance . . . 41

Chapter 3

WEBSMART PHP CONCEPTS . . . 43

What is WebSmart PHP? . . . 44

Advantages of Using WebSmart to Build Web-Based Applications . . . 45

WebSmart Definitions. . . 46

PHP . . . 47

HTML . . . 48

The WebSmart Programming Model . . . 50

(6)

6 Table of Contents

SECTION II

G

ETTING

S

TARTED

Chapter 4

BUILDING YOUR FIRST PROGRAM WITH WEBSMART PHP . . . 55

Overview . . . 55

What is a WebSmart ‘Definition’? . . . 57

Part 1 - Creating Your First Program . . . 58

Verifying your Configuration . . . 58

Selecting a Template . . . 59

The WebSmart IDE . . . 66

Part 2 - Understanding the HTML . . . 69

The ListHeader Segment. . . 70

The Body Components of the Segment ListHeader . . . 73

The ListDetails Segment . . . 76

The ListFooter, PageFooter, ListPrev and ListNext Segments . . . 77

The RcdDisplay Segment . . . 77

Working with the Record List Fields. . . 77

Understanding the PHP Code . . . 80

Conclusion . . . 83

SECTION III

W

EB

S

MART

IDE R

EFERENCE

Chapter 5

IDE WIZARDS: DEFINITION CREATION OPTIONS. . . 87

Creating New Definitions and Choosing your Template . . . 89

WebSmart Templates: An Overview . . . 90

Overview of the Main Template Categories. . . 91

The ODBC Connection Required During the Design Process . . . 91

Descriptions of the WebSmart Program Templates . . . 92

A Simple Page Template . . . 92

The CSS, HTML Page and JavaScript Templates . . . 92

The Input Capable Page at a Time Template. . . 93

The Page at a Time Maintenance Template. . . 95

The Record Listing Template . . . 97

The Single Record Maintenance Template . . . 98

(7)

Table of Contents 7

Additional Design Options . . . 103

A Simple Page Template . . . 103

Input Capable List Page at a Time Template . . . 104

The Page at a Time Maintenance Template. . . 105

Record Listing Template . . . 105

Single Record Maintenance Template . . . 106

SQL Page at a Time Maint Template . . . 107

Creating Calculated Fields . . . 110

Defining the Field Attributes . . . 110

Defining the Field Logic . . . 111

Using Functions in Calculated Fields . . . 112

File Maintenance Options . . . 116

Selecting the Files and Fields for your Program . . . 118

Adding New Files . . . 119

Browsing the iSeries for Files . . . 120

Selecting a File from the Repository . . . 121

Reviewing File Fields . . . 122

Changing Selected Files. . . 122

Deleting a File from the Definition . . . 123

Synchronizing your Files. . . 123

Viewing File Data. . . 123

Selecting File Fields . . . 124

The WebSmart IDE . . . 126

Chapter 6

IDE GENERAL REFERENCE: COMMON DESIGN FUNCTIONS. . . 127

The IDE Layout . . . 128

Using the Tabbed Interface. . . 128

Changing the Default IDE Layout . . . 128

Working with the Main Window . . . 129

Setting Bookmarks in Your Code . . . 129

Using the WebSmart IDE to Edit Other Files (JavaScript, Style Sheets, etc.) . . . 130

The Fields and Functions Window . . . 133

Placing Fields in PHP Definitions . . . 134

The Functions and Snippets Window . . . 135

Working with PML, PHP and JavaScript Functions. . . 135

Working with HTML, PML and PHP Snippets. . . 135

PHP and PML SmartSnippets . . . 137

WebSmart IDE Menu Options: Overview . . . 142

The File Menu . . . 142

The MRU Files List . . . 143

The Edit Menu . . . 144

(8)

8 Table of Contents

The Attributes Menu . . . 146

Previews. . . 147

Working with Preview Definitions . . . 149

The View Menu . . . 150

Working with the File Repository . . . 152

Repository Options . . . 153

Repository Import Features . . . 155

Validating the HTML, PML and PHP . . . 156

Formatting your Code . . . 157

SQL Prototyping . . . 158

The Help Menu . . . 159

Chapter 7

USING THE HTML DESIGN TOOLS . . . 161

HTML Editing Modes . . . 161

HTML Color Coding. . . 162

PHP in HTML Segments . . . 163

Working with the HTML . . . 164

HTML Segments . . . 165

HTML Right Click Options . . . 168

Inserting Colors . . . 168

Inserting Calendars . . . 169

Inserting HTML . . . 170

Validating Your HTML . . . 171

HTML Wizards . . . 173

Inserting Simple HTML Elements. . . 174

Inserting Tables and Table Components . . . 179

Inserting Table Rows . . . 180

Inserting Table Cells . . . 181

Inserting Forms . . . 182

Inserting Buttons . . . 183

Inserting a Text Input . . . 184

Inserting a Radio Button . . . 185

Inserting a Checkbox. . . 186

Inserting Password Fields . . . 187

Inserting an HTML Select Form . . . 188

Inserting Hidden Fields. . . 189

Inserting Text Areas . . . 190

Inserting Images . . . 191

Adding HTML Links to your Web Page. . . 192

Adding Special Characters . . . 193

Adding Lists to your Web Page . . . 193

(9)

Table of Contents 9

Vertical HTML View . . . 195

Editing the HTML in the Vertical View . . . 196

The Visual HTML View . . . 197

Previewing the Page Title HTML . . . 198

Text and Background Colors . . . 198

Manually Editing your Page Title HTML. . . 199

Advanced Formatting Options . . . 200

Chapter 8

USING THE PML AND PHP CODING TOOLS. . . 203

The IDE Code View . . . 204

Working with Multiple Files in the IDE . . . 204

The Functions List Window . . . 205

Using the Functions List Pane . . . 205

The Snippets and Information Tabs . . . 205

The Main Coding Window . . . 207

PHP Color Coding and Auto-Formatting . . . 207

Intelliprompting . . . 208

PHP Prototyping . . . 208

PHP Parameter Tooltips . . . 209

Syntax Checking the PHP . . . 209

PHP in HTML Segments . . . 211

Chapter 9

WEBSMART PROGRAM AND CONFIGURATION DEFAULTS . . . 213

General Program Options . . . 213

IDE Options . . . 214

Confirmations. . . 215

HTML Default Options. . . 216

Server Options . . . 219

iSeries Systems . . . 219

Other iSeries Settings. . . 221

FTP Servers . . . 222

Working with ODBC Connections (Other Databases) . . . 224

ILE Program Defaults . . . 226

PML Defaults . . . 226

Paths and Repository Options . . . 227

Generator Files . . . 229

PHP Program Defaults . . . 230

(10)

10 Table of Contents

Working with WebSmart IDE Environments . . . 232

When Should I Create an Environment? . . . 232

Configuring Environments. . . 233

Creating New Environments . . . 234

Running Multiple Versions of WebSmart Concurrently . . . 237

The WEBSMART IBM HTTP Server Instance . . . 238

Overview . . . 238

Access to the WAS Configuration and Authentication Directives. . . 244

Did you Make any Changes to the Default Configuration?. . . 244

TCP/IP Communications Configuration and Defaults . . . 245

Configuring the iSeries Side of Exodus . . . 245

TCP/IP Implementation of Exodus . . . 246

Configuration Options for TCP/IP . . . 248

The ZCFGTCP (Configure TCP/IP) Command. . . 249

Security Considerations . . . 250

SECTION IV

P

ROGRAMMING

R

EFERENCE

T

OPICS

Chapter 10

BCD PHP FUNCTION REFERENCE . . . 253 wrtseg . . . 254 xl_db2connect . . . 255 xl_decrypt . . . 256 xl_encrypt . . . 257 xl_i5_connect . . . 258 xl_mysql_connect . . . 259 xl_quote_string . . . 260 xl_raw_to_array . . . 261 xl_set_libl . . . 262 xl_set_row_color . . . 263

INDEX

Index . . . 265

(11)

Section I - Introduction and Installation Instructions

SECTION

I

Introduction and Installation

Instructions

In this Section:

Chapter 1 - An Introduction to WebSmart

Chapter 2 - Installation and Configuration

Chapter 3 - WebSmart PHP Concepts

(12)
(13)

1 - An Introduction to WebSmart

C

H A P T E R

1

An Introduction to WebSmart

Read this chapter for a quick overview of the software and some suggestions on how to learn to use WebSmart. The installation instructions are in Chapter 2. Chapter 3 explains in more detail how WebSmart works and what it can do for you.

What is WebSmart?

WebSmart is a multi-award winning iSeries rapid web application development tool that you can use to quickly build powerful and secure web applications and web services. WebSmart’s IDE is a versatile Windows-based design tool that seamlessly accesses your iSeries database. It includes application templates, sophisticated wizards, an HTML editor, 100+ routines, SQL prototyping, a visual integrated debugger and more. You can use WebSmart to create both ILE-CGI and PHP applications.

WebSmart is technology that you will easily understand. Its flexibility lets you build new applications or extend existing ones. You can create any application for any industry: Inquiries, Maintenance, Order/Entry, eCommerce, B2B, B2C, Wireless and more. It supports advanced web technologies such as SOA, Web Services, AJAX, Graphical Business Metrics and KPIs, and output to Excel. WebSmart is IBM ServerProven and listed on IBM’s System i Developer Roadmap.

WebSmart can be used by one or many developers. It includes sophisticated project and change management features such as version archiving, comparisons between versions, organize applications into projects, checkin/checkout, test versus production

environments with flexible runtime library list management and more. WebSmart also integrates with commercial change management solutions from other vendors. Even if you have never written web applications before, WebSmart lets you quickly produce true Web applications that take full advantage of all the latest technologies and Web programming techniques. If, as an RPG programmer you are concerned about being able to make the transition, keep in mind that almost all WebSmart developers started out in the RPG world. The software together with our support team will help you to succeed too!

(14)

14 Section I - Introduction and Installation Instructions

Productivity Benefits

WebSmart has many features to boost your productivity as you write applications for deployment in browsers or as Web Services (SOA). Intelligent templates and wizards step you through the entire creation of applications with no coding or HTML knowledge required. Customizable templates let you ‘skin’ an application with your corporate identity - including graphics, Flash components, etc.

You can use WebSmart's standard HTML editor, or the WYSIWYG visual HTML editor. A file repository lets you optionally define business rules, presentation rules, custom HTML components and database relations at the database level, so you maximize productivity by avoiding repetitive coding. All these rules and design elements are automatically included in the application when you first design a program in WebSmart.

Product Structure

The product consists of three main components, one on the PC and two on the server. The core WebSmart component is a Windows® application for designing web pages and integrating iSeries data elements. The WebSmart Integrated Development Environment (IDE) includes wizards and templates for building off-the-shelf programs with little or no coding effort. And though the templates can produce full-featured programs with no coding on your part, you can also add custom logic to your programs using a simple, Java-like language called Program Macro Language (PML) or, if you are using WebSmart PHP, by writing your own PHP code. So the main function of the IDE is really to be a code editor that allows you to extend the logic of your programs to build powerful applications. The IDE also includes an interactive HTML editor to customize the look of the output pages.

There are also two iSeries components:

The first iSeries component is a code generator to produce the server-side

programs that interact with the browser.

The second iSeries component is a Web Application Server that facilitates

running the generated programs. The programs are generated in ILE RPG, and take full advantage of RPG IV and ILE features, such as bound modules, service programs, subprocedures and free-format RPG. You can also bind in modules written in other ILE languages.

The three WebSmart components work seamlessly together to help you code and produce powerful and sophisticated web applications without having to first master all the complexities of coding CGI programs by hand.

(15)

Chapter 1 - An Introduction to WebSmart 15

WebSmart ILE and WebSmart PHP

WebSmart is really three tools in one: WebSmart ILE, WebSmart PHP and Clover. The section below outline the similarities and differences between the ILE and PHP versions of the software (Clover is discussed further below).

WebSmart ILE Runtime Model

Here is an image illustrating the WebSmart ILE runtime model:

Figure 1-1. The WebSmart ILE runtime model.

Web page content is delivered to the user by the following mechanisms:

The user requests a URL on an iSeries server from a browser (PC).

The iSeries HTTP Web Server (Powered by Apache, running in the QHTTPSVR) accepts the request and processes it.

If the request includes a call to a CGI program, the program is invoked by the

iSeries Web Server.

If the program is a WebSmart program, the WebSmart Web Application Server

(WAS) is used to provide all the supporting functions for the programs to interact with a browser. For example, translation of data provided from the browser to the server program is done by functions in the WAS. The WAS resides on the iSeries in a library called XL_WEBSPT.

If the program is designed for file access or maintenance, the ILE program

(16)

16 Section I - Introduction and Installation Instructions

The CGI program (WebSmart pgm) reads input parameters from the user

request (via the Web Server).

The CGI program constructs a web page, by merging static pieces of HTML

with live data from the target database and writes the page to the Web Server. Finally, the Web Server sends the web page to the User, via the browser.

WebSmart PHP Runtime Model

Here is an image illustrating the WebSmart PHP runtime model, when using the iSeries as your server:

Figure 1-2. The WebSmart PHP runtime model on the iSeries.

Web page content is delivered to the user by the following mechanisms:

The user requests a URL on an iSeries server from a browser (PC).

The iSeries HTTP Web Server (Powered by Apache, running in the QHTTPSVR)

accepts the request and processes it.

If the request includes a call to a PHP program, the program is invoked by the

iSeries Web Server.

The PHP program reads input parameters from the user request (via the Web

Server).

The Zend Core parses the requested PHP to construct a web page, merging

static pieces of HTML with live data, and writes the web page to the Web Server. Finally, the Web Server sends the web page to the user, via the browser.

(17)

Chapter 1 - An Introduction to WebSmart 17

Comparing WebSmart ILE and PHP

If you are evaluating both WebSmart ILE and PHP, and considering the purchase of one or both products, here are some considerations to take into account.

PHP and PML cannot be combined in a single program, but within an application there are no limits to combining PHP and ILE programs. You can transparently move from PHP to ILE programs via links, forms, menus or redirects, taking advantage of the strengths of both environments. Most WebSmart templates are available for both PHP and PML, and with a few small exceptions, also work exactly the same. You can work with both PHP and ILE definitions at the same time, in the same IDE session. All your definitions are shown as tabs across the top of the main window of the IDE.

Databases

WebSmart PHP currently includes templates for DB2/400 and MySQL. WebSmart ILE includes templates to create programs over DB2/400, as well as templates to create a JDBC connection program, and programs to work with MySQL and MsSQL tables (among others).

Server Platforms

WebSmart PHP can create programs to run on the iSeries, Linux, Unix or Windows. WebSmart ILE programs are designed to run only on the iSeries.

Languages

WebSmart ILE programs are coded entirely in PML and HTML, and generate ILE CGI code and compiled programs. WebSmart PHP programs are written entirely in PHP and HTML. PHP programs are interpreted, ILE programs are compiled.

PHP includes 5000+ functions, PML has 170+ functions. Both languages are growing, and while the number of PML functions may seem small, WebSmart ILE has been used for many years now to create hundreds of robust iSeries applications across dozens of industries. PHP is open source, but BCD’s PML is also extendable – you can create your own functions, or we can add them to the tool for you.

At present we have no plans to create a PML to PHP converter, though if you anticipate a need for this functionality, please let us know.

Learning Curve

WebSmart ILE generates RPG code, and the framework of the programs is very similar to how you would code things in RPG. In addition, a number of complex functions are encapsulated in custom functions that in the WebSmart WAS require hundreds or thousands of lines of support code. As a result, many RPG programmers find WebSmart ILE familiar, and not too difficult to pick up.

WebSmart PHP may be more of a challenge for an RPG programmer, but experienced PHP programmer should be able to quickly grasp the logic of the templates and

understand how to modify them, though learning the iSeries-specific PHP functions may also take some time.

(18)

18 Section I - Introduction and Installation Instructions

Experienced WebSmart ILE programmers learning to use WebSmart PHP will be familiar with the IDE, templates, structure and objectives of the generated code, and supporting files. By using the generously commented WebSmart PHP templates as a starting point for your coding, you should be able to get up to speed relatively quickly.

iSeries Integration

Zend and IBM have worked together to support PHP. PHP applications can run on the iSeries, connecting to DB2/400. Many key iSeries functions, such as calling external iSeries programs or handling library lists, are supported.

WebSmart ILE is even more tightly integrated into the iSeries, often requiring far fewer lines of code to execute basic functions.

Free Scripts and Example Programs

One website alone has over 10,000 free PHP scripts you can use, and a quick Web search will turn up many other resources. However, most of these are not intended for the business environment in which iSeries developers typically operate.

For WebSmart ILE, BCD has over 145 sample programs and scripts that you can download, and our Technical Support team can assist you with the creation of your own applications.

Hiring Pool

There are literally millions of PHP developers who can quickly start creating applications for you with WebSmart PHP. The WebSmart ILE development environment can quickly be mastered by RPG programmers and others who are reasonably familiar with the iSeries.

Object Oriented

PHP supports Object Oriented programming. This is not supported in ILE.

Performance and Scalability

While we haven’t yet conducted extensive performance tests, because WebSmart ILE produces compiled ILE programs and PHP is an interpreted language we believe that ILE programs written with PML will run faster on the iSeries.

Runtime Object Requirements

WebSmart ILE programs require that the WebSmart Web Application Server (WAS) be installed on the system where the application is running.

For details on the advantages of the WebSmart WAS (which encapsulates functionality sometimes requiring thousands of lines of code), please refer to the WebSmart ILE Reference Guide.

WebSmart PHP program require that Zend Core be installed on the iSeries. The WebSmart WAS is not needed for WebSmart PHP programs.

(19)

Chapter 1 - An Introduction to WebSmart 19

Other Miscellaneous Considerations

And finally, here are a few other considerations to take into account when evaluating whether to use WebSmart ILE, WebSmart PHP, or both:

PHP has excellent array support. In PHP the buffer is easily accessible.

With PHP there is no easy facility for working with multiple parameters with

the same names.

In PHP variable names are case sensitive, and prefixed with a $ sign.

In PHP field attributes (type, length) are not defined. This simplifies some tasks.

PHP is relatively new on the iSeries, and many of the advantages of using this programming language and model remain to be defined.

WebSmart PHP vs. Other PHP Editors

There are many PHP editors available, and some of them are very inexpensive or even free. However, when you choose to use WebSmart PHP to develop PHP applications, you are getting much more than a plain text editor with a few extra options.

iSeries Expertise

BCD has been specializing in the System i family of computers for 30+ years. We understand how System i developers and IT shops think and work, and we understand where they are coming from in terms of experience. We know the System i platform inside out. BCD has a proven track record of stability and longevity as a System i market leader.

Complete Integration in the WebSmart IDE

If you already use WebSmart ILE you will find the transition to WebSmart PHP intuitive. They share the same design infrastructure and functionality; and you don’t need to learn a completely new IDE. As a developer using WebSmart, you can move seamlessly between writing ILE CGI applications and PHP applications.

Intelligent Templates and Wizards

WebSmart PHP includes DB2 SQL, MySQL and Record Level Access templates that guide you through every step to create powerful dynamic Web applications. Most PHP editors don't include templates; you start with a blank palette, leaving you wondering what to do next; WebSmart PHP guides you through every step to create powerful dynamic web applications.

Central Repository

Like WebSmart ILE, WebSmart PHP has a central repository where you can define business, database and presentation rules at the database level, effectively providing powerful data modeling capabilities. Once extensions are defined in the Repository the intelligent templates can exploit them.

(20)

20 Section I - Introduction and Installation Instructions

Powerful Integrated Text-Based and Visual HTML Design Tools

WebSmart PHP includes both text based and visual HTML design tools. Other editors may not include an HTML visual editor or HTML wizards. The visual design tool gives you a WYSIWYG view of your pages as you design them, and helps eliminate one of the initial barriers to creating web applications by minimizing the need for detailed HTML knowledge.

Unique Separation of Content Presentation from Logic

In most PHP editors, the logic (PHP) and the presentation (HTML) is interleaved. In WebSmart PHP the content presentation is separated from behavior (PHP programming logic) making it easier to both code your page design and application logic. This is sometimes known as the Model-View-Controller approach. The separated model used by WebSmart has the following advantages:

The code is much easier to read.

It is much simpler for people with different skillsets (developers and designers)

to work on separate tasks without stepping on each other’s toes. When PHP and HTML are completely interleaved, your developers need a much higher level of HTML knowledge, and it’s difficult or impossible to effectively involve

designers.

It is easier to re-use PHP and HTML code snippets.

And if you use the WebSmart PHP templates, these also make extensive use of external CSS and JavaScript files, further modularizing your application’s functionality and design.

SmartCharts

WebSmart PHP includes license-free Flash graphs, charts, gauges and meters (often called KPIs or business metrics). SmartCharts easily integrate into your applications to visually improve the communication of your enterprise data.

5,000+ PHP Functions Cataloged and Integrated into the WebSmart IDE

The 5000+ available PHP functions can be a blessing or a curse. In WebSmart PHP, related functions are organized into tabs and integrated into the IDE development environment with real-time PHP syntax checking, prompting, color-coding and formatting. Most other PHP editors are simply generic programming language editors with limited color coding.

As you add your PHP functions, WebSmart PHP shows you a prototype of the function along with tool tips to explain any parameters used by the function. The IDE also supports context-sensitive help for any function. All these features help reduce errors in your code, even before you start application testing.

(21)

Chapter 1 - An Introduction to WebSmart 21

Strong Integration with DB2 in the Design Environment

The WebSmart PHP IDE displays file attributes, field lists and file keys. This is a great help as you write your PHP or HTML code, and when you create joins.

If you are creating applications to run on the iSeries, WebSmart PHP has functions that help you use library lists at run-time, providing flexibility for how you reference database files or make calls to existing RPG or other ILE programs. This simplifies the task of managing test and production environments.

Built-in FTP Client with Multiple Server Connection Capability

WebSmart PHP comes with its own fully integrated FTP client, which you can use to easily connect to multiple servers, System i or otherwise, from the IDE. You upload or download files through the folder tree interface, making it easy to manage development efforts across multiple servers, platforms, and databases.

Technical Support

The BCD Technical Support is consistently rated as one of the best in the industry. Our support agreements provide you with unlimited phone, email and web support for the life of the agreement. Clients evaluating BCD software also receive unlimited, free telephone and email support. Support from most PHP editors is very limited.

System i Web Consulting

The BCD Professional Services group is available to help you create custom templates, add key modules, or build your entire application.

Integrated Suite of Products

WebSmart PHP is also part of a complete integrated suite of products that provide a full range of functionality, including RPG ILE/CGI Web development (WebSmart ILE), web application frameworks (Nexus Portal), dynamic Flash graphs (SmartCharts) and automated report distribution (Catapult).

(22)

22 Section I - Introduction and Installation Instructions

WebSmart and Clover

WebSmart provides a platform to create sophisticated web applications such as file maintenance and order entry, shopping carts, web forums, document management, web services oriented applications, corporate portals, etc. – just about any business

application you can imagine. Using WebSmart’s coding environment, you can also write business reports such as sales analysis, invoices, and so on.

However, some of the features of typical reports, such as subtotals and break values, require additional coding within the tool to accomplish. Clover addresses these limitations with a new interface, tightly integrated with many of the existing features of the IDE, to enable you to write reports with little or no coding.

Clover has its own set of templates that drive the report creation wizards, making it easy to create reports with breaks, subtotals, graphs, etc. Using the included SQL wizard, you can relate many files (for example, join a header to a detail file) and define how you want the data sorted, filtered and reported. Clover also includes a variety of SmartCharts templates, to create SmartCharts using the wizard, rather than having to code them by hand.

(23)

Chapter 1 - An Introduction to WebSmart 23

How Should I Get Started?

To get started, begin by installing the software. If you haven’t done so already, you can find instructions in Chapter 2, or at our website (when you download the software). After you have installed WebSmart and verified your connection to the iSeries, we recommend that you review the suggestions below to help you decide how to get started.

I would like a live demo with a Technical Support team member.

BCD provides free live demos of WebSmart to new users. If you would like to have someone give you a detailed walk-through of the product, pointing out all the key features and explaining how they work, just contact your sales rep or visit our web site to request a demo. You can also call our Technical Support line at any time for a short, ad-hoc walkthrough to get you going.

For our demos we use GoToMeeting, which means that we can do the demo on our system or yours. We can either walk you through the steps on your system (intervening when you get stuck) or you can just watch us go through the demo on our own system. By using your system, you ensure that everything is set up and working right before you tackle things on your own. Or you may prefer to view the demo on our system, so you can try out the software without having to install it.

I want to build a program immediately.

Section II of this guide includes some simple exercises that walk you through creating a series of programs. These will help you familiarize yourself with key design steps and concepts. Or better yet, just try the templates over your own data files - you’ll be amazed at how easy it is to get going.

I want to see examples of specific features and how they are coded.

Once you’ve built a few programs using the templates the next logical step will be for you to start adding specific features to your programs. Before you start on this stage, we recommend you review our example programs at http://esdi.excelsystems.com/

iseries400apps/EXLIST.pgm. This listing includes more than 130 programs highlighting features we are often asked about. These programs include illustrations of HTML, SQL, PML, PHP and JavaScript coding. You can browse the list or search for specific features. Then you can review the code, or download the definitions and generate them at your site (as they all use our example files in XL_WEBDEMO). We also have a gallery of WebSmart applications at http://esdi.excelsystems.com/iseries400apps/cn_gallery.pgm. And keep in mind that this list is populated from questions and ideas sent to us by people like yourself - so if there’s something you need to do, and you don’t see it in the list, give Tech Support a call. If it hasn’t been done before, chances are we’ll do it for you!

I want to learn a little bit more about the software.

If you haven’t yet created web applications, WebSmart will introduce you to dozens of new concepts. We try to make our guides general educational resources for web development, as well as instruction manuals specific to WebSmart.

(24)

24 Section I - Introduction and Installation Instructions

Chapter 3 is a fairly simple overview of how the software works, and after reading that a good choice is to simply start creating programs, beginning in Section II - Getting Started. At the outset, you will likely find this more useful than just reading through the reference sections of this guide.

Of course, if you like reading reference guides, don’t let us stop you from doing that too!

I want to make sure that my system will be secure.

Balancing the needs of security and access is a tricky thing. Fortunately, the iSeries has some great features that will satisfy even the most paranoid among us. For some basic information on ensuring that your iSeries isn’t open to the world, review the footnotes on the default configuration we install, in the section “The WEBSMART IBM HTTP Server Instance” on page 238 of Chapter 9. For a more in-depth discussion of the different methods of implementing security at all different tiers, please read Chapter 13 of the WebSmart ILE Reference Guide.

I want to understand the specific challenges I’ll face as an RPG programmer.

Programming for the Web is a completely different environment from what you are accustomed to on the iSeries. While the look and feel of your applications is an obvious difference that’s immediately apparent, there are other, lower-level differences that you’ll need to understand before you can effectively build applications with more than just a single page of data.

One of the key concepts you may initially wrestle with is the notion of ‘stateless’ programming. To help you understand this new programming environment, we recommend you start by quickly reading Chapter 3, in particular the section entitled “Stateless Programming” on page 52.

I want to learn a bit more about PHP.

If you are unfamiliar with PHP there are also many good PHP tutorials available online, such as Zend’s PHP 101 tutorial at http://devzone.zend.com/node/view/id/627. W3 Schools also has a PHP tutorial at http://www.w3schools.com/php/default.asp. Zend also has a useful guide entitled Zend Core for i5/OS, which you can view online.

I’m a good programmer, but I don’t know anything about HTML.

Sooner or later you will have to learn at least some basic HTML. If you have ever worked with template-based application development tools, you know that the templates are nice, but it’s not too long before you want to start tweaking your programs to better suit your needs – and often you start with the UI. With web applications, this means making changes to the HTML.

The WebSmart IDE allows you to edit your HTML manually or using the built-in visual HTML editor. In practice, like all visual HTML tools, WebSmart’s has some inherent limitations, which means that eventually you’ll want to get into the HTML code directly. While the Web itself is the best resource for learning HTML, the WebSmart ILE Reference guide includes a Web Page Design for Green-Screeners guide. If you read through that chapter and try out the examples, you should be able to learn enough to

(25)

Chapter 1 - An Introduction to WebSmart 25

understand the structure of the HTML component of the programs WebSmart builds for you. You can then start to making changes to your own generated pages, and work on creating new pages from scratch (though in fact, with HTML almost everyone starts from a copy of something else as a starting point...).

I know how to use WebSmart, and want to create some custom templates.

If you already have online applications or a corporate website, you will probably want your WebSmart applications to match their look and feel. While you could work with each individual program to this end, it’s a good idea to start thinking about creating a custom set of the templates for yourself. Chapter 10 of the WebSmart ILE Reference Guide describes how to work with the templates. The three main WebSmart template families, Idaho, Lincoln and MacLeod, have been designed to be easy to modify, so you can quickly add your own corporate logos or new structural elements.

If you are wanting to do a more ambitious re-design of the templates, you may want to delegate the task to the most competent HTML programmer at your site (if your mostly concerned with the appearance), or even consider contracting the Professional Services division at BCD to take care of for you.

I’d like BCD to start building programs for me.

BCD doesn’t just sell WebSmart. WebSmart was created by BCD’s sister company, ExcelSystems Software Development (ESDI). ESDI has created dozens of custom applications and hundreds of programs for our WebSmart customers, for both public and internal sites.

If you have decided that WebSmart is your tool of choice for putting your applications online, but you don’t have the resources in-house to get yourself started, there is no better choice of contractor than the BCD/ESDI Professional Services team to help you. We have very competitive rates, and our consulting staff work hand in hand with the developers to ensure that each program makes the most effective use of the software. And where necessary, we can even enhance the software to suit your needs!

For details visit our Professional Services division’s home page at www.bcdsoftware.com.

I feel totally daunted. I have no clue where to start. I definitely need help.

Making the transition to developing web applications can be difficult. But don’t despair! WebSmart is in its sixth version, and to date hundreds of programmers like yourself (and some probably even more green-screen hardened!) have entered the exciting world of web application design.

If after the suggestions above you still feel overwhelmed, or you don’t think you’ll ever have the time to get yourself sorted out, contact Technical Support to talk about how we can help you out. You can arrange a walk-through with a member of our Help Desk team or one of our trainers. We’re confident that you’ll find our support superb; we’ll patiently walk you through the program design processes from start to finish, and give you lots of helpful pointers along the way.

(26)

26 Section I - Introduction and Installation Instructions

WebSmart Training Classes

We offer frequent training seminars at our location in beautiful Sidney, BC, located on Vancouver Island (off the West coast of Canada, 5 minutes from the Victoria

International Airport) as well as elsewhere in North America. If there are more than a couple of programmers at your site, it is more cost-efficient to have us pay you a visit and spend a few days with you doing training. And if you have a good training room, we can also invite other WebSmart customers in your area to attend the training and help offset your costs.

Contact BCD for details, or visit our web site at www.bcdsoftware.com for detailed information on the available training options.

(27)

2 - Installation and Configuration

C

H A P T E R

2

Installation and Configuration

This chapter guides you through setting up WebSmart so you can design, create and execute programs in the default environment. As you start building production applications, you may want to adjust some of the settings, particularly the HTTP configuration directives relating to object locations, or create your own HTTP server instances (if you don’t have them already). If you need help setting up your own working environment, or have any questions about the install, contact Technical Support.

The instructions describe how to install and configure all WebSmart 7.0 components. Some steps are only required for particular features or particular situations, so read the comments at the top of each step before proceeding. Follow the steps that apply to you. If you are using WebSmart on more than one system, or intend to do so, review the section Creating non-CGI Batch Programs, in the WebSmart ILE User Guide.

If you have a myBCDsoftware.com profile you don’t need to fill out the software download form every time you get software. Contact Technical Support or visit our website (esdi.excelsystems.com/iseries400apps/acc_reques.pgm) to request a profile.

Are you upgrading to V6R1 and already use a WebSmart version older than v 7.0?

The upgrade to V6R1 is not like most regular System i OS upgrades. While there is always a risk of incompatibilities surfacing as a result of an OS upgrade, in this case it is a certainty (http://www-03.ibm.com/systems/i/advantages/v6r1/conversion.html). If you have created WebSmart programs on any release prior to version 7 of

WebSmart, you need to regenerate and recompile all those programs so they can be bound to the new WebSmart service program.

Running the IBM command ANZOBJCVN over a WebSmart program can leave you with the mistaken impression that it will run correctly on V6R1. This is not necessarily the case. Service programs in XL_WEBSPT that are referenced by your program must also be able to be converted, and prior to WebSmart version 7.0, this was not the case.

(28)

28 Section I - Introduction and Installation Instructions

Step 1: End the EXODUS Subsystem.

The WebSmart IDE (the design tool) uses a communications middleware component called EXODUS to transfer data between the iSeries and PCs at different times while you are creating your programs. For example, EXODUS is used to retrieve iSeries file layouts, or upload code to be compiled. EXODUS is also used by BCD’s Spool-Explorer/400 and Catapult.

Before installing WebSmart you need to make sure that there are no EXODUS jobs running, to ensure there are no locks on objects that need to be updated or replaced. Here is how you can verify that you are ready to install WebSmart:

Sign on to an iSeries session as QSECOFR and run the WRKACTJOB command.

Check whether there is an active subsystem called EXODUS. If the subsystem is not active, you can proceed directly to Step 2.

If the EXODUS subsystem is active, then someone at your site may be working with an application that uses EXODUS for communications. To see a list of these jobs, run the command WRKOBJLCK XL_EXODUS *LIB. You can then you can contact the users associated with these jobs to request that they end their connections, or if you know what the jobs are, you can end them yourself.

After ending all EXODUS jobs, run the following command to end the EXODUS subsystem:

ENDSBS SBS(EXODUS) OPTION(*IMMED). Ignore any message stating ‘No subsystem Exodus active’.

When the EXODUS subsystem has stopped, you can continue with the next step.

Step 1 is required for: Upgrades, and if you have BCD’s Catapult or Spool-Explorer installed. If this is a new install, and you know you don’t have Catapult or Spool-Explorer installed and running, skip to the next step.

If one of the jobs using EXODUS is the Catapult Poller, end the Poller from the PC where it is running rather than by just ending the job on the iSeries.

(29)

Chapter 2 - Installation and Configuration 29

Step 2: Install Zend Core.

Before you can create and run programs with WebSmart PHP you need to install Zend Core. To verify whether you have Zend Core installed, follow these steps:

1. At an iSeries session, run the command GO LICPGM. 2. Select option 10.

3. Verify that licensed program 1ZCORE5 is installed.

If Zend Core is not installed, you can download it for free from the Zend website, at http://www.zend.com/products/zend_core (in the PDF version of this guide you can click this URL to go there now).

The Zend website also lists the Zend Core system requirements.

After installing Zend Core you can continue with the next step.

Step 2 is required for: WebSmart PHP. If you have no plans to use or evaluate WebSmart PHP, skip to the next step.

However, if you think you might at some time try out WebSmart PHP, install Zend Core first so the WebSmart install can automatically detect it and adjust the WEBSMART HTTP server instance accordingly. If you install Zend Core afterwards, you’ll need to make these adjustments manually.

If you have installed any release of WebSmart before installing Zend Core, you will need to manually add some directives to your WEBSMART Apache HTTP server instance (or any server instance you regularly use). These changes are described in the WebSmart PHP Knowledge Base article 6910 at www.bcdsoftware.com.

(30)

30 Section I - Introduction and Installation Instructions

Step 3: Install the WebSmart iSeries Components.

Follow the instructions below to install and start the WebSmart iSeries components. 1. Go to the Download Free Software link at www.bcdsoftware.com (at the top

right of the page). Once there, fill out the form to download WebSmart. 2. Download both the iSeries and PC installation files.

3. When the download finishes, double-click the iSeries install executable file WebSmart7.0.exe (the version number may vary) to unpack the files and transfer them to your iSeries.

4. When prompted, enter your iSeries IP address and the QSECOFR password:

Figure 2-1. The upload utility presented when you execute the iSeries install file.

Click the Upload button. When the upload finishes the activity log displays the message ‘File upload complete’. You can then close the FTP utility.

5. Log on to an iSeries session as QSECOFR and execute the command

BCDINSTALL/BCDINSTALL.

6. Select option 1 next to the product WebSmart 7.0 (the version may vary) and press Enter to begin the installation. The iSeries libraries installed are

XL_WEBLIB, XL_WEBSPT, XL_WEBDEMO, XL_EXODUS and BCDSUPPT.

7. When prompted enter the license key provided to you by BCD. If you have not yet received a license key phone BCD at (630) 986-0800, or email [email protected]. You can enter your license key after installing using the command XL_WEBLIB/UNLOCK.

Finally, when the iSeries install concludes, run the command WRKACTJOB to verify that the EXODUS subsystem is active and contains a job called EXSERVER. If the subsystem hasn’t been started, run the command STRSBS XL_EXODUS/EXODUS.

(31)

Chapter 2 - Installation and Configuration 31

The WEBSMART HTTP Server Instance

As part of your WebSmart iSeries install we create, configure and start an Apache HTTP server instance named WEBSMART, running on port 8150. This allows you to start running your programs as soon as you install the software.

You can use the WEBSMART HTTP server instance however you want, but we recommend that once you start creating production applications, you create your own server instances and use those. In our own internal development projects we have caused the HTTP server instances to go down due to malformed SQL and other programmatic issues, so we recommend that you create at least two separate server instances, for your development and production environments.

If you need assistance with creating your own server instances, please call Technical Support and we can help you out.

Testing your WebSmart ILE Install

The installation includes a sample program you can run to verify whether all the components required to run ILE programs from your iSeries were successfully installed. To try the sample program, type the following URL into your browser (or if you are viewing the PDF version of this guide, copy and paste this string). Replace the IP address shown with that of your own iSeries. Leave the :8150 for the port number specified in our default configuration setup:

http://your_ip_address:8150/webapps/testcfg.pgm

If the test program runs fine, then you can continue with the sections below.

Testing your WebSmart PHP Install

The installation also includes a sample PHP program you can run to verify that the critical components required to run PHP programs were successfully installed.

To run the sample program, type the following URL into your browser, replacing the IP address shown with that of your own iSeries. Leave the :8150 for the port number specified in our default configuration setup:

http://your_ip_address:8150/wsphp/testcfg.php

If the test program appears, continue with the sections below.

If either of your test programs doesn’t work, please contact our Technical Support team at (250) 655-1766 [7:30 - 5:00 PST], or by email at [email protected]. We have excellent support and we will be happy to help you out.

Or if you are particularly ambitious you can attempt to identify the problem yourself using the troubleshooting suggestions at the end of this chapter. This could also be a useful preview of the types of things you will need to check once you start creating your own live applications!

(32)

32 Section I - Introduction and Installation Instructions

Step 4: Install the WebSmart PC Component.

Follow the steps below to install the WebSmart PC design tool:

1. If you haven’t yet done so, go to the www.bcdsoftware.com Download Free Software link. Fill out the form to download WebSmart and then download the WebSmart PC component.

2. When the download finishes double-click the downloaded file to unpack the install files and initiate the install. The PC install file is named

websmart7.0client.exe [the version number may vary].

3. Follow the instructions to install the WebSmart executables to your PC. 4. When the installation is complete, click Finish to exit InstallShield.

You have now installed WebSmart. To launch the WebSmart Integrated Development Environment, double-click the icon in the open folder, or go to Start/Programs/ WebSmart 7.0/WebSmart (this version number may vary).

Continue with the next step to configure the connection between the WebSmart PC and iSeries design components, and create a new FTP connection.

(33)

Chapter 2 - Installation and Configuration 33

Step 5: Configure the WebSmart IDE to Connect to the iSeries.

The WebSmart IDE needs to be configured to connect to the iSeries so it can retrieve file layouts and perform other functions related to your iSeries database. Follow these steps:

1. Launch the WebSmart IDE (Start/Programs/WebSmart 7.0/WebSmart). 2. The software will automatically detect whether you have configured a

connection to the server, and if not, prompts you to add a system:

Figure 2-2. Creating a new iSeries system description.

3. Enter your system name and IP (or DNS). Port 2015 usually works.

4. From the iSeries System configuration you can also set default values for a few options that you need to specify every time you create a new WebSmart ILE program. These include your RPG source file and object libraries. The program object library XL_WEBAPPS will work in conjunction with the standard WEBSMART HTTP server instance configuration.

Step 5 is required for: all WebSmart installs.

At V6R1 IBM has taken over the use of Port 2015. If you are at V6R1 or higher, use port 7015 or any other available port. Then run the command XL_EXODUS/ZCFGTCP on your iSeries to change the port used by the server component.

If this is a new install and you choose to use a different library, you will also need to adjust the default configuration for the WEBSMART HTTP server instance or create your own HTTP server instance to use instead.

(34)

34 Section I - Introduction and Installation Instructions

5. For the default web path to object, enter the following:

http://your_ip_address:8150/webapps/

where ‘your_ip_address’ is the IP address of your iSeries (make sure you don’t forget the port number and final slash shown above).

6. To confirm your configuration click the Test Connection button. When you do this WebSmart prompts you to sign on to your iSeries and then displays a confirmation message.

7. Click OK to add the configuration entry.

If you will be working with more than one system, you can add them all now. This assumes that you are using the default configuration and the WEBSMART HTTP server instance. The Program Attributes are described in the section “ILE Program Defaults” on page 226 of Chapter 9 of the Reference Guide.

If you don’t get a successful connection, here are a couple of things to check:

The most common connection error (10061) is caused by the EXODUS

subsystem not being active. To address this run the WRKACTJOB command and check whether the EXODUS subsystem is running and contains a job called

EXSERVER. If not, run the command STRSBS XL_EXODUS/EXODUS. If the subsystem is running but EXSERVER is not, end and restart the subsystem and confirm the job is added. Then try connecting again.

If the subsystem is up, add XL_EXODUS to the library list of your iSeries session

and run the command ZDSPERRLOG to display a list of your connection attempts. Check for error messages (such as invalid User IDs, etc.).

If you can’t spot the problem immediately, call Technical Support at (250) 655-1766.

If you will be working in a relatively complex development environment, such as developing applications on multiple systems, or using multiple FTP sites or databases, review the section “Working with WebSmart IDE Environments” on page 232 of Chapter 9 of the Reference Guide.

(35)

Chapter 2 - Installation and Configuration 35

Step 6: Create an FTP Connection.

WebSmart PHP requires at least one FTP connection. Your FTP connections allow you retrieve and work with files related to your application, as well as set defaults for the PHP programs you create.

In WebSmart IDE, open the Tools/Options window and click the FTP entry to present these options:

Figure 2-3. The WebSmart default FTP options.

Enter the following values for your new FTP site:

Step 6 is required for: WebSmart PHP installs. If you do not plan to create PHP programs, skip to the next step.

Option Description

Site Name Type an informational description of the site you are connecting to.

URL Enter the IP address or domain name of your server.

Initial Directory Enter the initial directory to be displayed. For WebSmart, use this value: ‘/www/websmart/htdocs/wsphp/’ (with no quotes).

Click here

(36)

36 Section I - Introduction and Installation Instructions

After entering the required values, click the Test Connection button to verify that you have entered your configuration details correctly. If the confirmation window tells you that the connection is working, continue with the next section.

Web Path Select a default path to pre-pend to your program name when you click the Launch button from within the IDE. The default WebSmart Apache HTTP server instance runs on port 8150, so this should normally be set to ‘http://your_iSeries_IP:8150/wsphp/’ (no quotes). User/Password. Enter the user profile and password to use to connect to the iSeries

when saving the PHP files.

FTP Port Select the FTP port on the remote system. The default value of 21 should usually work for you.

Passive Mode Check this option if you need to establish your FTP connection in passive mode.

If you didn’t get a successful connection, double-check your values. If you have established links to the server in another application, compare your settings to those. For additional information on your FTP connections, please refer to the sections “FTP Servers” and “Automatically Reconciling FTP Sites” on page 223.

You can also create and modify your FTP connections from the window pane at the lower left of the main IDE. Just right-click in the area below the FTP Sites tab to present the available options.

If you will be working in a relatively complex development environment, such as developing applications on multiple systems, or using multiple FTP sites or databases, review the section “Working with WebSmart IDE Environments” on page 232 of Chapter 9 of the Reference Guide.

(37)

Chapter 2 - Installation and Configuration 37

Step 7: Create an ODBC Connection.

If you intend to use WebSmart to create programs over other databases (such as MySQL in PHP, and MySQL, MsSQL or Oracle in ILE) you need to create an ODBC connection to your target database so WebSmart can load the file layouts. To create a new ODBC connection, launch the WebSmart IDE and go to the Tools/Options menu. Select the Servers/Databases section and click Add to present these options:

Figure 2-4. Attributes of an ODBC connection (Tools/Options).

Here is a description of the options you need to enter:

Test your connection, then press OK to create it.

Step 7 is required for: WebSmart ILE or PHP programs running over databases other than DB2. If you will not create programs over non-DB2 tables, skip to the next step.

Option Description

Name/Description Type a name and description for this ODBC connection. Server/Port Type a server IP and port number.

Database Enter the database name.

User/Password Type the User ID and password to be used to connect to this server.

Driver Select the driver.

Click here

(38)

38 Section I - Introduction and Installation Instructions

Step 8: Set a Default User Profile for WebSmart PHP Programs.

After installing WebSmart PHP you need to set a number of connection defaults so your programs can access your iSeries and database. While there are a few ways to handle this requirement, the WebSmart PHP program templates are set up to retrieve the

connection values from a file on your IFS. When you execute WebSmart PHP programs, the first thing they attempt to do is load a preferences file, xl_functions001.php, by executing this statement at the top of the code:

require('/esdi/websmart/v7.0/include/xl_functions001.php');

This file includes a section where you can specify default user profiles and system names (among other things). However, because this file is overwritten when you upgrade, it in turn attempts to load some defaults from another file, xl_user_preferences.php, which you need to create (see our online WebSmart PHP KB article 6998 for additional details).

Create xl_user_preferences.php

In your iSeries IFS, open the file /esdi/websmart/v7.0/include/xl_functions001.php. Save the file as xl_user_preferences.php (or copy and rename xl_functions.php). In the new, copied file delete everything from (and including) this line up to the end of the file:

@include('xl_user_preferences.php');

Leave the ?> at the end of the file. In the section that remains in xl_user_preferences.php enter default values for the connections you will be using, as described here:

When you create your own application you may want to load your User IDs another way (for example, by prompting the user to enter one), but this approach will get you started.

Step 8 is required for: WebSmart PHP installs, where you will be running PHP programs on your iSeries and/or MySQL server. If you are only using WebSmart ILE, skip this step.

Value Description

$pf_i5UserID and

$pf_i5Password

iSeries user profile and password to use for all i5

connections. If this value is left blank, Zend Core will use the special profile ‘NOBODY’.

$pf_i5IPAddress Unless you are by default connecting from your iSeries to another one, use the loopback value 127.0.0.1 here.

$pf_db2SystemName Enter your iSeries system name for all database file access.

$pf_db2UserID and

$pf_db2Password

iSeries user profile and password to use by default for all DB2 access.

$pf_mysqlUrl Default MySQL server to connect to.

$pf_mysqlUserId and

$pf_mysqlPassword

Default MySQL server user profile and password.

References

Related documents