• No results found

About us. Proximity 2015

N/A
N/A
Protected

Academic year: 2021

Share "About us. Proximity 2015"

Copied!
83
0
0

Loading.... (view fulltext now)

Full text

(1)
(2)
(3)

Agenda

What is open source?

PHP for open source

PHP on IBM i

Live install of Zend Server

Live install of Zend DBi

What are Zend Server applications?

Hands-on install from a .zpk

Hands-on install from source

Zend Server - A brief tour

(4)

Objectives – what are yours?

What is your experience of open source applications?

What is your experience of PHP, MySQL or Zend Server?

Would you run an open source application on IBM i for your business?

Are you interested in any specific open source applications?

(5)

Objectives – what are ours?

An understanding of open source applications on IBM i

Implementation of Zend Server and Zend DBi

Installation of an open source application of your choice

Basic configuration of your open source application

An open source application up and running

(6)
(7)
(8)

Open source solutions

Source code made available for free under license

License provides rights to study, change and distribute

Core code is free, but expect to pay for anything beyond this

• Extra features

• “Skins” for CMS systems

• Support

Cost of maintaining the software

• Your time

(9)

Open source solutions

Can use any language or database, but PHP and MySQL is a popular combination

PHP and MySQL are available on IBM i

(10)

Open source solutions

We will install the following

• Zend Server – PHP engine, Apache web server • Zend DBi – MySQL database

This gives us our iAMP “stack”

• i = IBM i • A = Apache • M = MySQL • P = PHP IBM i Apache MySQL PHP Applications

(11)

PHP on IBM i

A great choice for web development

• Easy to learn, especially for RPG developers • PHP itself is open source and free to use • Widely used

Strong PHP community

• Extensive resources and tools available • Wealth of education materials

(12)

PHP on IBM i

HTTP request

HTML, CSS, JS etc.

(13)
(14)

Installing Zend Server – who are Zend?

Founded by Andi Gutmans and Zeev Suraski in 1999

Provides products and services relating to PHP

• Zend Server

• Zend DBi

• Zend Studio

(15)

Installing Zend Server – what is Zend Server?

The PHP engine (and not just on IBM i)

Complete application server, including web server

Brought to IBM i thanks to collaboration between IBM and Zend

Basic version is free for IBM i (with forum support)

(16)

Installing Zend Server – prerequisites

Folder /usr/local exists

Ports 10080 - 10083 are available

Licensed programs and PTFs appropriate to the OS version are installed

Zend Server not already installed

(17)

Installing Zend Server – prerequisites

For IBM i 6.1

Current PTF Group for 5761DG1 (minimum SF99115 Group 13)

FastCGI PTFs

Licensed Program Product Option Description

5761SS1 33 Portable App Solutions Environment

5761SS1 30 Qshell

5761DG1 *BASE IBM HTTP Server for i 5733SC1 *BASE IBM Portable Utilities for i

(18)

Installing Zend Server – prerequisites

For IBM i 7.1

Current PTF Group for 5770DG1 (minimum SF99368 Group 1)

Licensed Program Product Option Description

5770SS1 33 Portable App Solutions Environment

5770SS1 30 Qshell

5770DG1 *BASE IBM HTTP Server for i 5733SC1 *BASE IBM Portable Utilities for i

(19)

Installing Zend Server – prerequisites

For IBM i 7.2

No additional PTFs required

Licensed Program Product Option Description

5770SS1 33 Portable App Solutions Environment

5770SS1 30 Qshell

5770DG1 *BASE IBM HTTP Server for i 5733SC1 *BASE IBM Portable Utilities for i

(20)

Installing Zend Server – installing the software

Download the appropriate SAVF from the Zend website,

and FTP to the IBM i

Choose your installation mode

• Silent (a.k.a. Batch) • Interactive

• We will choose interactive

RSTLICPGM LICPGM(6ZSVRPI) DEV(*SAVF) SAVF(QGPL/ZSVRSAVF6)

(21)

Straw Poll

What IBM i version are you running?

Do you have Zend Server installed?

Do you have any PHP / web development skills?

Is your business using Open Source PHP applications on other platforms?

Do you run Zend Server on Windows or Linux?

(22)

Installing Zend Server – completing the installation

• Zend Server Console

• Web based UI for configuration and monitoring of Zend Server • Navigate to http://<your_server_IP>:10081/ZendServer

• First time in there will be initial configuration to do

• Accept the license agreement

• Select the appropriate launch profile • Development

• Production

• Set the admin and developer user passwords • Deploy source libraries

(23)
(24)

Installing Zend Server

Validate the installation

• Navigate to http://<your_server_IP>:10080 • Zend Server Test Page should be displayed

Check the subsystem on the IBM i

• For ease, we will use Presto to provide 5250 access via a browser • Navigate to http://<your_server_IP>:8022/presto/presto

• Log in with QSECOFR / Proximity!!

(25)
(26)

Installing Zend DBi – what is Zend DBi?

MySQL binaries, compiled to run on IBM i

Functionally identical to MySQL

Popular, widely used open source database

The database of choice for many open source applications

(27)

Installing Zend DBi – installing the software

Can be done as a second stage of the initial Zend Server installation

GO ZENDSVR6/ZSMENU

then take option 6 – ZendDBi Management menu and installation will start

NOTE: QSECOFR privileges are required!

(28)

Installing Zend DBi – verifying the installation

A new subsystem and daemon job are created, so check that the

subsystem is running

WRKACTJOB SBS(ZENDDBI)

Can also access the command line interface via QSH or QP2TERM

QSH

then

cd /usr/local/mysql/bin

mysql –u root

(29)

Installing Zend DBi – verifying the installation

After installation, the root user password should be set

> set password for ‘root’@’localhost’ = password(‘Proximity!!’) > quit

To access the command line interface, we now need to enter

(30)
(31)

Installing Zend DBi

Verify the installation

• Navigate to http://<your_server_IP>:8022/presto/presto • Log in with QSECOFR / Proximity!!

• GO ZENDSVR6/ZSMENU > 6 > 2

Access the command line interface

• QSH

• cd /usr/local/mysql/bin

• mysql –u root --pass=‘Proximity!!’ • > show databases;

(32)
(33)

Zend Server applications – what are they?

Any software that you run using Zend Server

• Open source applications

• Packaged, e.g. Magento, Drupal

• From Source, e.g. MediaWiki, Adminer • Your own developed applications

• STREAM (delivery and transport management) in our case

Once an application is configured, you can

• View statistics and logging information relating to the application • Define monitoring rules specific to the application

(34)

Zend Server applications – how to define an application

Applications are created automatically when you deploy from a package

You can also manually define an application for

• Your manually developed code

• Other applications installed from source

(35)
(36)

Installing an application from a .zpk – overview

Zend provide a number of pre-packaged Open Source applications that can be

installed directly from the Zend Server console

• Magento– e-commerce

• Drupal – content management

• WordPress – content management / blog • Joomla – content management

• phpMyAdmin – database admin tool • phpBB– forum

• We have successfully deployed all of these, and use Drupal running on IBM i for all

our company websites

(37)

Installing an application from a .zpk – example

• We use Drupal extensively, so we will us this as an example

(38)
(39)
(40)
(41)
(42)
(43)
(44)
(45)

Installing an application from a .zpk – manual download

• Alternative approach, if you already have the .zpk file

• Access the Zend Server Console

• Applications > Apps > Deploy Application • Specify the location of the .zpk

Remaining steps are as before

Some config tweaks may be needed to ensure upload does not time out

(46)

Installing an Application from a .zpk – under the covers

• Source is deployed in /usr/local/zendsvr6/var/apps/http/__default__/0

• A .conf file is generated and saved in /usr/local/zendsvr6/etc/sites.d/http/__default__/0

• The .conf files are included within the Apache config file

• Provides the necessary alias information to let Apache locate the application

Any staging and activation scripts defined in the package are executed

• Application config based on the supplied parameters • Generation of MySQL database if required

(47)
(48)

Installing an application from a .zpk

• Access the Zend Server Console

• Navigate to http://<your_server_IP>:10081/ZendServer • Log in with admin / Proximity!!

Deploy an application

• Click on the Guide Page tab

• Click on the application you want to deploy

• Follow the steps defined on the crib sheet provided for the application

Launch the application and have a wander around

(49)
(50)

Installing an application from source – overview

Any application written in PHP that uses MySQL for the database can be

implemented on IBM i

The examples we will look at today are

• Adminer – database admin tool

• SugarCRM – CRM tool

• Mantis BT – bug tracker • Media Wiki – wiki

(51)

Installing an application from source – archives

Typically, source will be provided in a .zip or .tar archive for ease of downloading

Both of these types can be unpacked on the IBM i

(52)

Installing an application from source – unpacking .zip files

Download the .zip file to the IFS, go into QSH or QP2TERM and enter

jar tf <myFilePath>

to list the contents of the archive

Navigate to the location that you want to extract to and enter

jar xf <myFilePath>

(53)

Installing an application from source – unpacking .tar files

Download the .tar file to the IFS, go into QSH or QP2TERM and enter

tar -tf <myFilePath>

to list the contents of the archive

Navigate to the location that you want to extract to and enter

tar -xf <myFilePath>

(54)

Installing an application from source – unpacking .tar files

• The native tar command can be problematic, as file paths are limited to 100 characters

• If you get a @longlink file after unpacking, the path limit has been exceeded and some files will be missing or wrongly named

• There are two ways to address this …

• The easy approach – save the .tar file to the IFS root and unpack, then move to the correct location • This will only work if the file paths are now less than 100 characters

• The hard approach – install the Open Source binary for the GNU version of the tar command • More information on how to do this is available at …

• http://www-01.ibm.com/support/docview.wss?uid=nas8N1011528

(55)

Installing an application from source – example

Adminer is a lightweight MySQL management tool

Single script file, so easy to install

(56)
(57)
(58)
(59)
(60)

Installing an application from source – definition

(61)
(62)
(63)
(64)
(65)

Installing an application from source

Create a folder within htdocs for the application and set the folder authority

• Navigate to http://<your_server_IP>:8022/presto/presto • Log in with QSECOFR / Proximity!!

• wrklnk '/www/zendsvr6/htdocs/*‘

• mkdir ‘/www/zendsvr6/htdocs/<your_folder_name>’

• Take option 9=Work with Authority against the new folder

• Grant user QHTTPSVR *RWX data and *ALL object authority

Upload the source

(66)

Installing an application from source

Unpack the source (if necessary)

• For .zip files

• In QSH or QP2TERM

• cd /www/zendsvr6/htdocs/<your_folder_name> • jar xf <your_file_name>

• For .tar files

• In QSH or QP2TERM

• cd /www/zendsvr6/htdocs/<your_folder_name> • tar –xf <your_file_name>

(67)

Installing an application from source

Define the Application within Zend Server

• Navigate to http://<your_server_IP>:10081/ZendServer • Log in with admin / Proximity!!

• Click on the Applications tab • Click Define Application

• Follow the steps defined on the crib sheet provided for the application

Launch the application and have a wander around

(68)

Troubleshooting

Most common problems are authority related

• Try granting QTMHHTTP full authority to the application folder and all contents

Check the logs!

• PHP log in Zend Server console • Apache logs in /www/zendsvr6/logs

(69)
(70)

Zend Server Console – overview – dashboard

Default landing page when you log into the console

Displays overview information for the server

• Server statistics • System events

(71)

Zend Server Console – applications

Lists defined and deployed applications

Displays information for individual applications

• Application status • Summary information

Provides access to application monitoring and caching rules

(72)

Zend Server Console – configurations

Configuration of various aspects of Zend Server

• Components – enable/disable and configure Zend Server Components • Deployment – required for us!

• Important for app performance – Data Cache, OPCache, Page Cache • Important for monitoring – Code Tracing, Monitor, Statistics

• PHP – configure installed PHP components • Z-Ray – fantastic tool for developers – more later

(73)

Zend Server Console – administration

Day-to-day administration of Zend Server

• Servers – allows restart of server and shows any server level errors • Audit Trail – shows log of changes made to the server

• Users – change passwords for admin and developer users

• Web API – maintenance of Web API keys, used in Zend Studio integration and when accessing the server via its API layer (e.g. from Jenkins or other CI tools)

(74)

Zend Server Console – Z-Ray Live

Developer tool that gives insight into PHP code by delivering detailed

information into a browser component

Information includes

• PHP functions • SQL queries

• Request variables • Errors and warnings • Server events

• Memory usage

Z-Ray Live allows this data to be viewed for requests from devices where browser

component is not appropriate, e.g. mobile applications, API calls

(75)
(76)

Configuring Zend Server – top tips

As seen on PowerWire.eu

• Character Set Configuration • Multibyte Support

• Compression

Bonus Tip! Memory Pools and Run Priorities

(77)

Configuring Zend Server – character sets

Get this right now and you’ll never have character set problems In /www/zendsvr6/conf/httpd.conf DefaultFsCCSID 00285 CGIJobCCSID 00285 DefaultNetCCSID 01208 AddCharset UTF-8 .htm .html .xml In /www/zendsvr6/conf/fastcgi.conf

(78)

Configuring Zend Server – character sets

In /usr/local/zendsvr6/share/ToolkitAPI/toolkit.ini encoding = “UTF-8”

In the console, go to Configurations > PHP > ibm_db2

(79)

Configuring Zend Server – multibyte support

Means you’re not limited to ASCII

In the console, go to Configurations > PHP > mbstring mbstring.http_output – set to UTF-8

mbstring.internal_encoding – set to UTF-8 mbstring.encoding_translation – set to On mbstring.http_input – set to Pass

(80)

Configuring Zend Server – compression

A very quick win – speeds up response times of web pages In /www/zendsvr6/conf/httpd.conf

LoadModule deflate_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM AddOutputFilterByType DEFLATE application/x-httpd-php

application/json text/css application/x-javascript application/javascript text/html

(81)

Configuring Zend Server – memory pools and run priorities

Worth considering for Production systems where resources are shared with legacy applications Use WRKSHRPOOLto define one of the shared pools as “Zend”

Use CHGSBSD to allocate the pool to subsystem ZENDSVR6

Change the Zend Server Class using WRKCLS ZENDSVR6/*ALL to set Run Priority to 20, equivalent to interactive jobs

(82)
(83)

Thanks

• i-UG for the opportunity

• Steve Bradshaw for the hardware and support

• You for attending

References

Related documents