SlideShare uma empresa Scribd logo
1 de 58
Baixar para ler offline
“From Zero to ZF” on IBM i
Your first Zend Framework project




         Alan Seiden Consulting
         alanseiden.com
My focus

   Advancing PHP on IBM i

   • PHP project leader, Zend/IBM Toolkit
   • Contributor, Zend Framework DB2/i enhancements
   • Developer, Best Web Solution, IBM/Common
   • Authority, subsecond web performance
       on IBM i/iSeries



Alan Seiden Consulting    2      From Zero to ZF on IBM i: Your first Zend Framework project
Contact information

   Alan Seiden
   alan@alanseiden.com
   201-447-2437


   alanseiden.com
   twitter: @alanseiden

Alan Seiden Consulting   3   From Zero to ZF on IBM i: Your first Zend Framework project
Where to download these slides


       From my site
       http://alanseiden.com/presentations

       On SlideShare
       http://slideshare.net/aseiden

       The latest version will be available on both sites




Alan Seiden Consulting             4         From Zero to ZF on IBM i: Your first Zend Framework project
Whom this talk is for

    • Experienced PHP developers…
             …will see a step-by-step demonstration of how to create a
              Zend Framework project that runs on the first try

    • Zend Framework developers…
             …will learn a streamlined, methodical approach that uses
              today’s tools


    • Others…
             …will maybe see something interesting.
              To beginning PHP developers: Regular PHP is fine. You will
              know when the time is right to jump in with ZF.




Alan Seiden Consulting                  5           From Zero to ZF on IBM i: Your first Zend Framework project
What we’ll do today

    • Help you get a feeling of SUCCESS
          with Zend Framework (v1.x) on IBM i

    • We’ll get you past common sticking points:
                Installing ZF
                Creating a remote project (IFS-based) in Zend Studio
                Apache web server configuration, including “rewrite” rules
                Adding to the default project
                Getting library lists to work (and other db2 on i options, too)


    • I’ll provide additional resources for study
    • And answer your questions
Alan Seiden Consulting                       6            From Zero to ZF on IBM i: Your first Zend Framework project
ZF Basics
What ZF is

   • PHP-based framework with
      best practices for PHP5, OO

   • Free and open source

   • Cross-platform

   • Developed by the community and full-time,
      dedicated Zend employees, with help from other
      important technology companies

   • Downloaded millions of times
Alan Seiden Consulting        8        From Zero to ZF on IBM i: Your first Zend Framework project
A component library AND a full framework

   • ZF includes popular individual components for mail,
      security, forms, PDF, web services, and much more.
          These components can be used from “regular” PHP
          They are the “gateway drug” of ZF


   • As a full stack framework, ZF includes a Model-View-
      Controller (MVC) architecture that makes apps easy
      to maintain




Alan Seiden Consulting               9          From Zero to ZF on IBM i: Your first Zend Framework project
Friendly URLs

   • ZF supports friendly URLs by default

    • URLs route to PHP script and function/method
            Defined by ZF’s router
            URL split into script/method/variables according to naming
             convention (controller and action)

    • Example: http://mysite.com/customer/list/division/2

    • In example above:
            Script: CustomerController.php
            Method/function: listAction()
            division = 2

Alan Seiden Consulting                  10           From Zero to ZF on IBM i: Your first Zend Framework project
MVC directory structure: more than MVC

   • Model, View, Controller folders, of course
   • “Public” folder, which is the only public folder
          Consistent with best security practices
          Public script index.php initiates a “Front controller”
   • Other resources such as configuration files, layouts,
      code libraries and documentation




Alan Seiden Consulting                   11            From Zero to ZF on IBM i: Your first Zend Framework project
How ZF fits with Zend’s product line

   • Zend Server http://www.zend.com/en/products/server/
          A value-added PHP install for IBM i, Linux, Windows, Mac OS X
          As “free” Community Edition (CE) and regular edition
          Installs a copy of Zend Framework


   • Zend Studio http://www.zend.com/en/products/studio/
          Integrated Development Environment (IDE)
          IBM i edition is “free” thanks to IBM/Zend relationship
          Also installs its own copy of Zend Framework! (on your PC)

   • Zend Framework http://framework.zend.com
          Can work with any PHP 5.x install, anywhere, but of course it
           works very well with the above products

Alan Seiden Consulting                 12           From Zero to ZF on IBM i: Your first Zend Framework project
Installing ZF
It’s already there--or download fresh

   • Installed automatically with Zend Server
      /usr/local/zendsvr/share/ZendFramework/library/zend

   • Updates available at http://framework.zend.com/download/
      latest
          Unzip into /usr/local… (see above) or your ZF library folder


   • PEAR channel on Google Code
          Instructions: http://engineeredweb.com/blog/10/6/
           installing-and-using-zend-framework-pear


   • More ideas: http://mikepavlak.blogspot.com/2010/09/
      updating-zend-framework-on-ibm-i.html



Alan Seiden Consulting                      14            From Zero to ZF on IBM i: Your first Zend Framework project
Zend Server’s easy default install

   • This way is fine when you are starting out

   • Folder is /usr/local/zendsvr/share/ZendFramework/
          Contains library/zend

   • PHP.INI specifies “/usr/local/zendsvr/share/
      ZendFramework/” in its include_path variable
          All your PHP applications will be able to find the library/
           zend folder without any further work




Alan Seiden Consulting                       15             From Zero to ZF on IBM i: Your first Zend Framework project
Step-by-step ZF
    project
Step by step ZF configuration
    • Set up SSH
           (server) on IBM i
           (client) in Zend Studio
    • Create project directory on remote server (IBM i)
    • Use Zend_Tool to generate skeleton project
           We’ll use Zend Studio’s Zend_Tool integration rather than
            PASE’s zf.sh script, though both work
    • Configure Apache webserver virtual host
    • Test basic project. It should run at this point
    • Configure DB2 adapter for IBM i and test db table
    • Create additional controller/action
Alan Seiden Consulting                  17           From Zero to ZF on IBM i: Your first Zend Framework project
SSH setup
SSH = Secure Shell protocol

   • Faster and more secure than FTP
   • Zend Studio connects over SSH to the IBM i
          SSH server (daemon) is IBM i
          SSH client is Zend Studio


   • Let’s see how to set up the server and client




Alan Seiden Consulting                19   From Zero to ZF on IBM i: Your first Zend Framework project
Starting SSH daemon (sshd) on IBM i

      • i6.1 or higher: one step creates keys and starts server
      STRTCPSVR *SSHD


      • V5R4: two steps
      First, create public/private key pairs:
      CALL QP2TERM
      ssh-keygen -t rsa1 -f /QOpenSys/QIBM/UserData/SC1/OpenSSH/
        openssh-3.5p1/etc/ssh_host_key -N ""
      ssh-keygen -t dsa -f /QOpenSys/QIBM/UserData/SC1/OpenSSH/
        openssh-3.5p1/etc/ssh_host_dsa_key -N ""
      ssh-keygen -t rsa -f /QOpenSys/QIBM/UserData/SC1/OpenSSH/
        openssh-3.5p1/etc/ssh_host_rsa_key -N "
                                                              For more on sshd setup, see
                                                              “Young i Professionals” wiki:
      Then start sshd (“&” means to run in background):
      /usr/sbin/sshd &
                                                              http://174.79.32.155/wiki/
                                                              index.php/PASE/SSHSetup

Alan Seiden Consulting                          20        From Zero to ZF on IBM i: Your first Zend Framework project
Zend Studio as an SSH client

      • Open the Remote Systems perspective
             (Window / Perspective / Remote Systems)
      • Click the “Define a connection…” button




Alan Seiden Consulting                 21          From Zero to ZF on IBM i: Your first Zend Framework project
Define connection to IBM i
 1. Choose SSH as connection type. Click “Next.”
 2. Provide host name (IP or domain name) of your “i”. Click “Finish.”




Alan Seiden Consulting           22          From Zero to ZF on IBM i: Your first Zend Framework project
Done! We’re connected to IBM i
 1. On left: Remote System Explorer, an IFS file list
 2. On right: Remote Shell, handy for entering shell commands
      (List of shell commands: http://ss64.com/bash)




Alan Seiden Consulting                      23         From Zero to ZF on IBM i: Your first Zend Framework project
Create project
  directory
Create IFS directory for project
 •    Typical directory pattern: /www/anything/htdocs
       • Example: /www/zfdemo/htdocs

 •    From 5250 screen, use “md” command for each dir level



 •    Or, better, use “mkdir” from PASE or Remote Shell in Zend Studio
      For example: “mkdir –p /www/zfdemo/htdocs”




  •     “-p” means “create parent folders if necessary”
  •     Verify it was created: WRKLNK or “ls /www/zfdemo/htdocs”



Alan Seiden Consulting                25           From Zero to ZF on IBM i: Your first Zend Framework project
Create project with
    Zend_Tool
Zend_Tool creates ZF files/folders for us
 •    It’s a component that sets up our project correctly and quickly

 •    Command-line interface: “zf” (lower case)
        •     UNIX or PASE: a shell script called zf.sh
        •     Zend Studio: use the “Zend Tool” menu option from the Project menu
                •        Keyboard shortcut: CTRL+2

 •    Another Studio interface to Zend_Tool is the “New…” wizard from
      the File menu
        •     Underneath, it calls the “zf” commands, so you might want to try it to learn
              the “zf” commands better

 •    Here we will use the “Zend Tool”option from Project menu
       • Make sure you clicked on the “PHP Explorer” pane first
       • zf command line looks like:



Alan Seiden Consulting                               27     From Zero to ZF on IBM i: Your first Zend Framework project
Launch Zend Tool command entry

   • Click on the PHP Explorer pane
   • Click Project, then Zend Tool
          Shortcut: CTRL+2




Alan Seiden Consulting        28      From Zero to ZF on IBM i: Your first Zend Framework project
Create the project

  • Let’s name the project “zfdemo”
         Will fit nicely with the folder we created, /www/zfdemo/htdocs
  • Type these commands into Zend Tool window:
         Go to Studio’s workspace root: “cd /”
         Create the project: “zf create project zfdemo”




   • Press F5 or File/Refresh to refresh view of files

Alan Seiden Consulting                  29           From Zero to ZF on IBM i: Your first Zend Framework project
Our project is there

  • You should see a complete project structure called
     zfdemo


                             IndexController: default controller
                             indexAction:    default action within
                                             a controller
                             “index” is a default name
                             (Compare index.html as the usual
                             homepage of a website)

   • The project exists in Studio’s workspace
   • Now we should link it to IFS for automatic
      synchronization

Alan Seiden Consulting       30            From Zero to ZF on IBM i: Your first Zend Framework project
Enable remote synch of project with IFS

  • Right-click the project
  • Choose “properties,” then “Remote Server Support”




Alan Seiden Consulting     31       From Zero to ZF on IBM i: Your first Zend Framework project
Set up the Remote Support settings

  • Click “Enable remote connection properties”
  • Choose the remote connection you created earlier
  • Type the Project Directory you created earlier
         Example: /www/zfdemo/htdocs
  • Leave “On Save” as upload method; click OK




Alan Seiden Consulting                  32   From Zero to ZF on IBM i: Your first Zend Framework project
Upload the project to IFS

  • You’ll be asked: “Do you want to upload all files to
     the remote server?”
         Click “Yes” then “Finish”




   • Project is now on IFS


Alan Seiden Consulting                33   From Zero to ZF on IBM i: Your first Zend Framework project
Project files are now on IFS

   • Verify with Remote Systems Explorer (use F5)
   • or WRKLNK ‘/www/zfdemo’




Alan Seiden Consulting      34        From Zero to ZF on IBM i: Your first Zend Framework project
Configure Apache
Control access/routing to our project
 •    The folder called “public”is Document Root, containing index.php




 •    Use Apache “rewrite rules” to route all ZF requests to index.php

 •    ZF’s router will examine the original REQUEST_URI to route
      request to correct controller and action




Alan Seiden Consulting             36          From Zero to ZF on IBM i: Your first Zend Framework project
More about Apache config

 • For performance and security, do not use .htaccess
   files in production systems

 • Put configurations in main httpd.conf instead

 • See example of correct virtual host config on next
   slide…




Alan Seiden Consulting      37       From Zero to ZF on IBM i: Your first Zend Framework project
Section from /www/zendsvr/conf/
httpd.conf
        # use your choice of IP and port, if they are not already in use elsewhere
        # Use 80 for a public site and 443 for SSL-encrypted
        Listen *:12345
        # NameVirtualHost allows us to share an IP address/port among multiple sites
        NameVirtualHost *:12345
        <VirtualHost *:12345>
            DocumentRoot "/www/zfdemo/htdocs/public"

              # specify ServerName if using NameVirtualHost (must match URL typed in browser)
              ServerName 1.2.3.4:12345

              # This should be omitted in the production environment
              SetEnv APPLICATION_ENV development

             #Detailed documentation: http://framework.zend.com/manual/en/project-structure.rewrite.html
             RewriteEngine off
             <Location />
                 RewriteEngine On
                 RewriteCond %{REQUEST_FILENAME} -s [OR]
                 RewriteCond %{REQUEST_FILENAME} -l [OR]
                 RewriteCond %{REQUEST_FILENAME} -d
                 RewriteRule ^.*$ - [NC,L]
                 RewriteRule ^.*$ /index.php [NC,L]
             </Location>
            <Directory "/www/zfdemo/htdocs/public">
                Options Indexes MultiViews FollowSymLinks
                AllowOverride None
                Order allow,deny
                Allow from all
            </Directory>

        </VirtualHost>




Alan Seiden Consulting                                 38                 From Zero to ZF on IBM i: Your first Zend Framework project
Update Apache conf and then restart
 •    Update /www/zendsvr/conf/httpd.conf with a config for your ZF project
       • Previous slide contains a solid template for you

 •    Restart Apache
      STRTCPSVR SERVER(*HTTP) RESTART(*HTTP) HTTPSVR(ZENDSVR)

 •    The sample project should run!
       • http://yourserver:port




Alan Seiden Consulting                 39          From Zero to ZF on IBM i: Your first Zend Framework project
Create more
controllers/actions
Zend_Tool continues to help

   • Let’s create a Customer controller
   • And then an action to show a list of customers
          Call it “list”
   • Once again, launch Studio’s Zend_Tool window
   • Create the Customer controller:
   cd /zfdemo
   zf create controller Customer

   • Press F5 to refresh, then create the ‘list’ action:
   zf create action list Customer
   • Refresh again (F5)

Alan Seiden Consulting         41         From Zero to ZF on IBM i: Your first Zend Framework project
Our new controller and action are there




    If you open the CustomerController.php file you will find:
    public function listAction()
    {
    }


Alan Seiden Consulting                42           From Zero to ZF on IBM i: Your first Zend Framework project
Configure DB2
Configure Zend_Db adapter for Db2

   At a minimum, create these settings:
   •   adapter type (Db2)
   •   username (may be blank)
   •   password (may be blank)
   •   dbname (may be blank or an entry from WRKRDBDIRE)


   Run: zf    configure db-adapter
       "adapter=Db2&username=alan&password=secretpw&dbname=*LOCAL"


   The above zf command creates four keys in application.ini:
   resources.db.adapter = Db2
   resources.db.params.username = "alan"
   resources.db.params.password = "secretpw"
   resources.db.params.dbname = "*LOCAL"

Alan Seiden Consulting                44          From Zero to ZF on IBM i: Your first Zend Framework project
Other useful keys for application.ini
   ; os="i5" ensures adapter will know we're an IBM i(i5)
   resources.db.params.os = "i5"

   ; persistent=true speeds performance
   resources.db.params.persistent = true

   ; autocommit=DB2_AUTOCOMMIT_ON for insert/update/delete
   resources.db.params.driver_options.autocommit = DB2_AUTOCOMMIT_ON


   ; i5_naming=DB2_I5_NAMING_ON means '/', not '.', is library sep.
   ;                            and allows library lists
   resources.db.params.driver_options.i5_naming = DB2_I5_NAMING_ON

   ; i5_libl= easy way to specify a library list (see i5_naming above)
   resources.db.params.driver_options.i5_libl = "LIB1 LIB2"



Alan Seiden Consulting            45          From Zero to ZF on IBM i: Your first Zend Framework project
Still more optional keys for application.ini
   ; isDefaultTableAdapter means to use this adapter for tables
   resources.db.isDefaultTableAdapter = true


   ;profiler is optional. lets you measure query performance.
   resources.db.params.profiler.class = "Zend_Db_Profiler_Firebug"
   resources.db.params.profiler.enabled = true




   Are we done? No… see the next slide for one more
    critical step




Alan Seiden Consulting            46          From Zero to ZF on IBM i: Your first Zend Framework project
Install IBM i-optimized DB2 adapter

   • As of ZF 1.x, the Db2.php adapter doesn't work quite
      right for all IBM i's use cases, such as:
          DB2_I5_NAMING = On
                 • Because library/schema separator is hardcoded as '.'
          Zend_Db_Table performance (metadata retrieval is slow)
          Ability to utilize certain .INI settings


   • I have a temporary fix for you. For ZF 2.x I’ll be working
      with the ZF team on an official fix.

   • See next slide for instructions


Alan Seiden Consulting                        47            From Zero to ZF on IBM i: Your first Zend Framework project
Installing my DB2 adapter fix
   •       Download corrected adapter from
           http://www.alanseiden.com/code/ibm-i-db2-zf-adapter.zip
   •       Extract instructions.txt and Db2.php
   •       Place Db2.php in the folder “library/Strategic/Db/Adapter/”
   •       Note: the “Adapter namespace” (first part of class name) is
           “Strategic” instead of “Zend.” This can be any name you choose.




Alan Seiden Consulting                     48           From Zero to ZF on IBM i: Your first Zend Framework project
Update application.ini with adapter name

   • In application.ini, add this setting:
           resources.db.params.adapterNamespace =
           Strategic_Db_Adapter

   • Now you are good to go
               In particular, library lists will work




Alan Seiden Consulting                      49           From Zero to ZF on IBM i: Your first Zend Framework project
Access a
DB2 table
Zend_Db_Table is one way to access data

   • Table classes created for us by Zend_Tool
   • You provide 2 names: 1) class to create 2) table name
               Example: I have a table called CUSTFILE
               Type “zf create dbtable Custfile CUSTFILE” (if uppercase table)
               See resulting class file in screen shot below
   • Then edit the class, esp. when primary key is not ‘id’




Alan Seiden Consulting                    51           From Zero to ZF on IBM i: Your first Zend Framework project
Read records using table class

   In controllers/Customer_Controller.php:
       public function listAction()
       {
               $custfile = new Application_Model_DbTable_Custfile();
               $custs = $custfile->fetchAll();
               $this->view->customers = $custs;
       }

   In views/scripts/customer/list.phtml (omitting the class and style tags):
   <H1>Customer list from CUSTFILE table</H1>
   <table class="list">
   <tr style="font-weight: bold; text-align: left;"><th>Number</th><th>Name</
     th><th>Status</th></tr>
   <?php
   $customers = $this->customers;
   foreach ($customers as $customer) {
   echo "<tr><td>{$customer->CUSTNO}</td>
            <td>{$customer->LNAME}</td>
            <td>{$customer->STATUS}</td></tr>";
   }
   ?>
Alan Seiden Consulting
   </table>                                       52            From Zero to ZF on IBM i: Your first Zend Framework project
Display results

   • URL: /customer/list




Alan Seiden Consulting     53   From Zero to ZF on IBM i: Your first Zend Framework project
We did it!

   • Now you know how to create a Zend Framework
         project on IBM i that will work on the first try, DB2
         and all
            ZF version 1.x. For 2.x, see my webcast on Dec. 11, 2012

   • These slides are online where you can refer to
         them

   • Send me feedback so I can continue to improve the
         process




Alan Seiden Consulting                 54          From Zero to ZF on IBM i: Your first Zend Framework project
Resources for learning ZF

      • Tutorials
               Official ZF quickstart: http://framework.zend.com/manual/en/
                learning.quickstart.html

               Rob Allen’s (author of Zend Framework in Action): http://
                akrabat.com/zend-framework-tutorial/

      • Online training
               (Zend) http://shop.zend.com/en/php-training/zend-framework-
                fundamentals.html

      • Forums
               http://forums.zend.com

      • User groups (Bring your laptop and ask a question!)
               http://framework.zend.com/community/groups




Alan Seiden Consulting                       55            From Zero to ZF on IBM i: Your first Zend Framework project
Questions
Alan’s upcoming appearances

  http://alanseiden.com/presentations/upcoming

   Oct. 17               Webcast   iPro Developer Online Conference
   Oct. 22-25            ZendCon   Santa Clara, Calif.
   Dec. 11               Webcast    Zend Framework 2 and IBM i




Alan Seiden Consulting                57        From Zero to ZF on IBM i: Your first Zend Framework project
Contact | Get tips

   Alan Seiden
   Alan Seiden Consulting
   Ho-Ho-Kus, NJ


   alanseiden.com




   Free tips newsletter: alanseiden.com/tips



   alan@alanseiden.com      ●   201-447-2437 ●     twitter: @alanseiden

Alan Seiden Consulting              58         From Zero to ZF on IBM i: Your first Zend Framework project

Mais conteúdo relacionado

Mais procurados

Web Performance First Aid
Web Performance First AidWeb Performance First Aid
Web Performance First AidAlan Seiden
 
Performance tuning with zend framework
Performance tuning with zend frameworkPerformance tuning with zend framework
Performance tuning with zend frameworkAlan Seiden
 
Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i  Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i Zend by Rogue Wave Software
 
Install MariaDB on IBM i - Tips, troubleshooting, and more
Install MariaDB on IBM i - Tips, troubleshooting, and moreInstall MariaDB on IBM i - Tips, troubleshooting, and more
Install MariaDB on IBM i - Tips, troubleshooting, and moreRod Flohr
 
PHP Installed on IBM i - the Nickel Tour
PHP Installed on IBM i - the Nickel TourPHP Installed on IBM i - the Nickel Tour
PHP Installed on IBM i - the Nickel TourRod Flohr
 
Zend Products and PHP for IBMi
Zend Products and PHP for IBMi  Zend Products and PHP for IBMi
Zend Products and PHP for IBMi Shlomo Vanunu
 
PHP on IBM i Tutorial
PHP on IBM i TutorialPHP on IBM i Tutorial
PHP on IBM i TutorialZendCon
 
Running open source PHP applications on you IBM i
Running open source PHP applications on you IBM iRunning open source PHP applications on you IBM i
Running open source PHP applications on you IBM iProximity Group
 
PHP on Windows - What's New
PHP on Windows - What's NewPHP on Windows - What's New
PHP on Windows - What's NewZendCon
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZendCon
 
Zend Core on IBM i - Security Considerations
Zend Core on IBM i - Security ConsiderationsZend Core on IBM i - Security Considerations
Zend Core on IBM i - Security ConsiderationsZendCon
 
PHP and Platform Independance in the Cloud
PHP and Platform Independance in the CloudPHP and Platform Independance in the Cloud
PHP and Platform Independance in the CloudZendCon
 
IBM Connections administration – keep your systems running the right way
IBM Connections administration – keep your systems running the right wayIBM Connections administration – keep your systems running the right way
IBM Connections administration – keep your systems running the right wayLetsConnect
 
Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginnersAdam Englander
 
Zend con what-i-learned-about-mobile-first
Zend con what-i-learned-about-mobile-firstZend con what-i-learned-about-mobile-first
Zend con what-i-learned-about-mobile-firstClark Everetts
 
IBM Connect 2016 - 60+ in 60 - Admin Tips Power Hour
IBM Connect 2016 - 60+ in 60 - Admin Tips Power HourIBM Connect 2016 - 60+ in 60 - Admin Tips Power Hour
IBM Connect 2016 - 60+ in 60 - Admin Tips Power HourChris Miller
 
IBM Connections Adminblast - Connect17 (DEV 1268)
IBM Connections Adminblast - Connect17 (DEV 1268)IBM Connections Adminblast - Connect17 (DEV 1268)
IBM Connections Adminblast - Connect17 (DEV 1268)Nico Meisenzahl
 
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...Heiko Voigt
 

Mais procurados (20)

Web Performance First Aid
Web Performance First AidWeb Performance First Aid
Web Performance First Aid
 
Getting started with PHP on IBM i
Getting started with PHP on IBM iGetting started with PHP on IBM i
Getting started with PHP on IBM i
 
Performance tuning with zend framework
Performance tuning with zend frameworkPerformance tuning with zend framework
Performance tuning with zend framework
 
Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i  Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i
 
Install MariaDB on IBM i - Tips, troubleshooting, and more
Install MariaDB on IBM i - Tips, troubleshooting, and moreInstall MariaDB on IBM i - Tips, troubleshooting, and more
Install MariaDB on IBM i - Tips, troubleshooting, and more
 
PHP Installed on IBM i - the Nickel Tour
PHP Installed on IBM i - the Nickel TourPHP Installed on IBM i - the Nickel Tour
PHP Installed on IBM i - the Nickel Tour
 
Zend Products and PHP for IBMi
Zend Products and PHP for IBMi  Zend Products and PHP for IBMi
Zend Products and PHP for IBMi
 
PHP on IBM i Tutorial
PHP on IBM i TutorialPHP on IBM i Tutorial
PHP on IBM i Tutorial
 
Running open source PHP applications on you IBM i
Running open source PHP applications on you IBM iRunning open source PHP applications on you IBM i
Running open source PHP applications on you IBM i
 
PHP on Windows - What's New
PHP on Windows - What's NewPHP on Windows - What's New
PHP on Windows - What's New
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and Extending
 
Zend Core on IBM i - Security Considerations
Zend Core on IBM i - Security ConsiderationsZend Core on IBM i - Security Considerations
Zend Core on IBM i - Security Considerations
 
PHP and Platform Independance in the Cloud
PHP and Platform Independance in the CloudPHP and Platform Independance in the Cloud
PHP and Platform Independance in the Cloud
 
Performance tuning PHP on IBMi
Performance tuning PHP on IBMiPerformance tuning PHP on IBMi
Performance tuning PHP on IBMi
 
IBM Connections administration – keep your systems running the right way
IBM Connections administration – keep your systems running the right wayIBM Connections administration – keep your systems running the right way
IBM Connections administration – keep your systems running the right way
 
Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginners
 
Zend con what-i-learned-about-mobile-first
Zend con what-i-learned-about-mobile-firstZend con what-i-learned-about-mobile-first
Zend con what-i-learned-about-mobile-first
 
IBM Connect 2016 - 60+ in 60 - Admin Tips Power Hour
IBM Connect 2016 - 60+ in 60 - Admin Tips Power HourIBM Connect 2016 - 60+ in 60 - Admin Tips Power Hour
IBM Connect 2016 - 60+ in 60 - Admin Tips Power Hour
 
IBM Connections Adminblast - Connect17 (DEV 1268)
IBM Connections Adminblast - Connect17 (DEV 1268)IBM Connections Adminblast - Connect17 (DEV 1268)
IBM Connections Adminblast - Connect17 (DEV 1268)
 
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
 

Destaque

Nuclear transformation (physics)
Nuclear transformation (physics)Nuclear transformation (physics)
Nuclear transformation (physics)Sheen May Velasco
 
iSecurity Data Sheet March 2016
iSecurity Data Sheet March 2016iSecurity Data Sheet March 2016
iSecurity Data Sheet March 2016Raz-Lee Security
 
Developing Secure IBM i Applications
Developing Secure IBM i ApplicationsDeveloping Secure IBM i Applications
Developing Secure IBM i ApplicationsHelpSystems
 
Lecture 25.2- Nuclear Transformations
Lecture 25.2- Nuclear TransformationsLecture 25.2- Nuclear Transformations
Lecture 25.2- Nuclear TransformationsMary Beth Smith
 
Working with the IFS on System i
Working with the IFS on System iWorking with the IFS on System i
Working with the IFS on System iChuck Walker
 

Destaque (6)

Nuclear transformation (physics)
Nuclear transformation (physics)Nuclear transformation (physics)
Nuclear transformation (physics)
 
iSecurity Data Sheet March 2016
iSecurity Data Sheet March 2016iSecurity Data Sheet March 2016
iSecurity Data Sheet March 2016
 
Developing Secure IBM i Applications
Developing Secure IBM i ApplicationsDeveloping Secure IBM i Applications
Developing Secure IBM i Applications
 
Lecture 25.2- Nuclear Transformations
Lecture 25.2- Nuclear TransformationsLecture 25.2- Nuclear Transformations
Lecture 25.2- Nuclear Transformations
 
Working with the IFS on System i
Working with the IFS on System iWorking with the IFS on System i
Working with the IFS on System i
 
Structure of atom
Structure of atomStructure of atom
Structure of atom
 

Semelhante a From Zero to ZF: Your first zend framework project on ibm i

Semelhante a From Zero to ZF: Your first zend framework project on ibm i (20)

Zend Framwork configurations
Zend Framwork configurationsZend Framwork configurations
Zend Framwork configurations
 
Zend Framwork presentation
Zend Framwork presentationZend Framwork presentation
Zend Framwork presentation
 
Zero to Zend Framework in 10 minutes
Zero to Zend Framework in 10 minutesZero to Zend Framework in 10 minutes
Zero to Zend Framework in 10 minutes
 
Zend Server - OSI Days
Zend Server - OSI DaysZend Server - OSI Days
Zend Server - OSI Days
 
Lamp Zend Security
Lamp Zend SecurityLamp Zend Security
Lamp Zend Security
 
Zend Code in ZF 2.0
Zend Code in ZF 2.0Zend Code in ZF 2.0
Zend Code in ZF 2.0
 
Zend
ZendZend
Zend
 
Zend Framework Handout
Zend Framework HandoutZend Framework Handout
Zend Framework Handout
 
Zend Framework Handout
Zend Framework HandoutZend Framework Handout
Zend Framework Handout
 
Extending ZF & Extending With ZF
Extending ZF & Extending With ZFExtending ZF & Extending With ZF
Extending ZF & Extending With ZF
 
Using Zend_Tool to Establish Your Project's Skeleton
Using Zend_Tool to Establish Your Project's SkeletonUsing Zend_Tool to Establish Your Project's Skeleton
Using Zend_Tool to Establish Your Project's Skeleton
 
PHP and Zend Framework on Windows
PHP and Zend Framework on WindowsPHP and Zend Framework on Windows
PHP and Zend Framework on Windows
 
green
greengreen
green
 
Zend Framework 1.8 workshop
Zend Framework 1.8 workshopZend Framework 1.8 workshop
Zend Framework 1.8 workshop
 
Zend framework 01 - introduction
Zend framework 01 - introductionZend framework 01 - introduction
Zend framework 01 - introduction
 
first pitch
first pitchfirst pitch
first pitch
 
werwr
werwrwerwr
werwr
 
sdfsdf
sdfsdfsdfsdf
sdfsdf
 
college
collegecollege
college
 
first pitch
first pitchfirst pitch
first pitch
 

Último

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 

From Zero to ZF: Your first zend framework project on ibm i

  • 1. “From Zero to ZF” on IBM i Your first Zend Framework project Alan Seiden Consulting alanseiden.com
  • 2. My focus Advancing PHP on IBM i • PHP project leader, Zend/IBM Toolkit • Contributor, Zend Framework DB2/i enhancements • Developer, Best Web Solution, IBM/Common • Authority, subsecond web performance on IBM i/iSeries Alan Seiden Consulting 2 From Zero to ZF on IBM i: Your first Zend Framework project
  • 3. Contact information Alan Seiden alan@alanseiden.com 201-447-2437 alanseiden.com twitter: @alanseiden Alan Seiden Consulting 3 From Zero to ZF on IBM i: Your first Zend Framework project
  • 4. Where to download these slides From my site http://alanseiden.com/presentations On SlideShare http://slideshare.net/aseiden The latest version will be available on both sites Alan Seiden Consulting 4 From Zero to ZF on IBM i: Your first Zend Framework project
  • 5. Whom this talk is for • Experienced PHP developers…  …will see a step-by-step demonstration of how to create a Zend Framework project that runs on the first try • Zend Framework developers…  …will learn a streamlined, methodical approach that uses today’s tools • Others…  …will maybe see something interesting. To beginning PHP developers: Regular PHP is fine. You will know when the time is right to jump in with ZF. Alan Seiden Consulting 5 From Zero to ZF on IBM i: Your first Zend Framework project
  • 6. What we’ll do today • Help you get a feeling of SUCCESS with Zend Framework (v1.x) on IBM i • We’ll get you past common sticking points:  Installing ZF  Creating a remote project (IFS-based) in Zend Studio  Apache web server configuration, including “rewrite” rules  Adding to the default project  Getting library lists to work (and other db2 on i options, too) • I’ll provide additional resources for study • And answer your questions Alan Seiden Consulting 6 From Zero to ZF on IBM i: Your first Zend Framework project
  • 8. What ZF is • PHP-based framework with best practices for PHP5, OO • Free and open source • Cross-platform • Developed by the community and full-time, dedicated Zend employees, with help from other important technology companies • Downloaded millions of times Alan Seiden Consulting 8 From Zero to ZF on IBM i: Your first Zend Framework project
  • 9. A component library AND a full framework • ZF includes popular individual components for mail, security, forms, PDF, web services, and much more.  These components can be used from “regular” PHP  They are the “gateway drug” of ZF • As a full stack framework, ZF includes a Model-View- Controller (MVC) architecture that makes apps easy to maintain Alan Seiden Consulting 9 From Zero to ZF on IBM i: Your first Zend Framework project
  • 10. Friendly URLs • ZF supports friendly URLs by default • URLs route to PHP script and function/method  Defined by ZF’s router  URL split into script/method/variables according to naming convention (controller and action) • Example: http://mysite.com/customer/list/division/2 • In example above:  Script: CustomerController.php  Method/function: listAction()  division = 2 Alan Seiden Consulting 10 From Zero to ZF on IBM i: Your first Zend Framework project
  • 11. MVC directory structure: more than MVC • Model, View, Controller folders, of course • “Public” folder, which is the only public folder  Consistent with best security practices  Public script index.php initiates a “Front controller” • Other resources such as configuration files, layouts, code libraries and documentation Alan Seiden Consulting 11 From Zero to ZF on IBM i: Your first Zend Framework project
  • 12. How ZF fits with Zend’s product line • Zend Server http://www.zend.com/en/products/server/  A value-added PHP install for IBM i, Linux, Windows, Mac OS X  As “free” Community Edition (CE) and regular edition  Installs a copy of Zend Framework • Zend Studio http://www.zend.com/en/products/studio/  Integrated Development Environment (IDE)  IBM i edition is “free” thanks to IBM/Zend relationship  Also installs its own copy of Zend Framework! (on your PC) • Zend Framework http://framework.zend.com  Can work with any PHP 5.x install, anywhere, but of course it works very well with the above products Alan Seiden Consulting 12 From Zero to ZF on IBM i: Your first Zend Framework project
  • 14. It’s already there--or download fresh • Installed automatically with Zend Server /usr/local/zendsvr/share/ZendFramework/library/zend • Updates available at http://framework.zend.com/download/ latest  Unzip into /usr/local… (see above) or your ZF library folder • PEAR channel on Google Code  Instructions: http://engineeredweb.com/blog/10/6/ installing-and-using-zend-framework-pear • More ideas: http://mikepavlak.blogspot.com/2010/09/ updating-zend-framework-on-ibm-i.html Alan Seiden Consulting 14 From Zero to ZF on IBM i: Your first Zend Framework project
  • 15. Zend Server’s easy default install • This way is fine when you are starting out • Folder is /usr/local/zendsvr/share/ZendFramework/  Contains library/zend • PHP.INI specifies “/usr/local/zendsvr/share/ ZendFramework/” in its include_path variable  All your PHP applications will be able to find the library/ zend folder without any further work Alan Seiden Consulting 15 From Zero to ZF on IBM i: Your first Zend Framework project
  • 16. Step-by-step ZF project
  • 17. Step by step ZF configuration • Set up SSH  (server) on IBM i  (client) in Zend Studio • Create project directory on remote server (IBM i) • Use Zend_Tool to generate skeleton project  We’ll use Zend Studio’s Zend_Tool integration rather than PASE’s zf.sh script, though both work • Configure Apache webserver virtual host • Test basic project. It should run at this point • Configure DB2 adapter for IBM i and test db table • Create additional controller/action Alan Seiden Consulting 17 From Zero to ZF on IBM i: Your first Zend Framework project
  • 19. SSH = Secure Shell protocol • Faster and more secure than FTP • Zend Studio connects over SSH to the IBM i  SSH server (daemon) is IBM i  SSH client is Zend Studio • Let’s see how to set up the server and client Alan Seiden Consulting 19 From Zero to ZF on IBM i: Your first Zend Framework project
  • 20. Starting SSH daemon (sshd) on IBM i • i6.1 or higher: one step creates keys and starts server STRTCPSVR *SSHD • V5R4: two steps First, create public/private key pairs: CALL QP2TERM ssh-keygen -t rsa1 -f /QOpenSys/QIBM/UserData/SC1/OpenSSH/ openssh-3.5p1/etc/ssh_host_key -N "" ssh-keygen -t dsa -f /QOpenSys/QIBM/UserData/SC1/OpenSSH/ openssh-3.5p1/etc/ssh_host_dsa_key -N "" ssh-keygen -t rsa -f /QOpenSys/QIBM/UserData/SC1/OpenSSH/ openssh-3.5p1/etc/ssh_host_rsa_key -N " For more on sshd setup, see “Young i Professionals” wiki: Then start sshd (“&” means to run in background): /usr/sbin/sshd & http://174.79.32.155/wiki/ index.php/PASE/SSHSetup Alan Seiden Consulting 20 From Zero to ZF on IBM i: Your first Zend Framework project
  • 21. Zend Studio as an SSH client • Open the Remote Systems perspective  (Window / Perspective / Remote Systems) • Click the “Define a connection…” button Alan Seiden Consulting 21 From Zero to ZF on IBM i: Your first Zend Framework project
  • 22. Define connection to IBM i 1. Choose SSH as connection type. Click “Next.” 2. Provide host name (IP or domain name) of your “i”. Click “Finish.” Alan Seiden Consulting 22 From Zero to ZF on IBM i: Your first Zend Framework project
  • 23. Done! We’re connected to IBM i 1. On left: Remote System Explorer, an IFS file list 2. On right: Remote Shell, handy for entering shell commands (List of shell commands: http://ss64.com/bash) Alan Seiden Consulting 23 From Zero to ZF on IBM i: Your first Zend Framework project
  • 24. Create project directory
  • 25. Create IFS directory for project • Typical directory pattern: /www/anything/htdocs • Example: /www/zfdemo/htdocs • From 5250 screen, use “md” command for each dir level • Or, better, use “mkdir” from PASE or Remote Shell in Zend Studio For example: “mkdir –p /www/zfdemo/htdocs” • “-p” means “create parent folders if necessary” • Verify it was created: WRKLNK or “ls /www/zfdemo/htdocs” Alan Seiden Consulting 25 From Zero to ZF on IBM i: Your first Zend Framework project
  • 26. Create project with Zend_Tool
  • 27. Zend_Tool creates ZF files/folders for us • It’s a component that sets up our project correctly and quickly • Command-line interface: “zf” (lower case) • UNIX or PASE: a shell script called zf.sh • Zend Studio: use the “Zend Tool” menu option from the Project menu • Keyboard shortcut: CTRL+2 • Another Studio interface to Zend_Tool is the “New…” wizard from the File menu • Underneath, it calls the “zf” commands, so you might want to try it to learn the “zf” commands better • Here we will use the “Zend Tool”option from Project menu • Make sure you clicked on the “PHP Explorer” pane first • zf command line looks like: Alan Seiden Consulting 27 From Zero to ZF on IBM i: Your first Zend Framework project
  • 28. Launch Zend Tool command entry • Click on the PHP Explorer pane • Click Project, then Zend Tool  Shortcut: CTRL+2 Alan Seiden Consulting 28 From Zero to ZF on IBM i: Your first Zend Framework project
  • 29. Create the project • Let’s name the project “zfdemo”  Will fit nicely with the folder we created, /www/zfdemo/htdocs • Type these commands into Zend Tool window:  Go to Studio’s workspace root: “cd /”  Create the project: “zf create project zfdemo” • Press F5 or File/Refresh to refresh view of files Alan Seiden Consulting 29 From Zero to ZF on IBM i: Your first Zend Framework project
  • 30. Our project is there • You should see a complete project structure called zfdemo IndexController: default controller indexAction: default action within a controller “index” is a default name (Compare index.html as the usual homepage of a website) • The project exists in Studio’s workspace • Now we should link it to IFS for automatic synchronization Alan Seiden Consulting 30 From Zero to ZF on IBM i: Your first Zend Framework project
  • 31. Enable remote synch of project with IFS • Right-click the project • Choose “properties,” then “Remote Server Support” Alan Seiden Consulting 31 From Zero to ZF on IBM i: Your first Zend Framework project
  • 32. Set up the Remote Support settings • Click “Enable remote connection properties” • Choose the remote connection you created earlier • Type the Project Directory you created earlier  Example: /www/zfdemo/htdocs • Leave “On Save” as upload method; click OK Alan Seiden Consulting 32 From Zero to ZF on IBM i: Your first Zend Framework project
  • 33. Upload the project to IFS • You’ll be asked: “Do you want to upload all files to the remote server?”  Click “Yes” then “Finish” • Project is now on IFS Alan Seiden Consulting 33 From Zero to ZF on IBM i: Your first Zend Framework project
  • 34. Project files are now on IFS • Verify with Remote Systems Explorer (use F5) • or WRKLNK ‘/www/zfdemo’ Alan Seiden Consulting 34 From Zero to ZF on IBM i: Your first Zend Framework project
  • 36. Control access/routing to our project • The folder called “public”is Document Root, containing index.php • Use Apache “rewrite rules” to route all ZF requests to index.php • ZF’s router will examine the original REQUEST_URI to route request to correct controller and action Alan Seiden Consulting 36 From Zero to ZF on IBM i: Your first Zend Framework project
  • 37. More about Apache config • For performance and security, do not use .htaccess files in production systems • Put configurations in main httpd.conf instead • See example of correct virtual host config on next slide… Alan Seiden Consulting 37 From Zero to ZF on IBM i: Your first Zend Framework project
  • 38. Section from /www/zendsvr/conf/ httpd.conf # use your choice of IP and port, if they are not already in use elsewhere # Use 80 for a public site and 443 for SSL-encrypted Listen *:12345 # NameVirtualHost allows us to share an IP address/port among multiple sites NameVirtualHost *:12345 <VirtualHost *:12345> DocumentRoot "/www/zfdemo/htdocs/public" # specify ServerName if using NameVirtualHost (must match URL typed in browser) ServerName 1.2.3.4:12345 # This should be omitted in the production environment SetEnv APPLICATION_ENV development #Detailed documentation: http://framework.zend.com/manual/en/project-structure.rewrite.html RewriteEngine off <Location /> RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ /index.php [NC,L] </Location> <Directory "/www/zfdemo/htdocs/public"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost> Alan Seiden Consulting 38 From Zero to ZF on IBM i: Your first Zend Framework project
  • 39. Update Apache conf and then restart • Update /www/zendsvr/conf/httpd.conf with a config for your ZF project • Previous slide contains a solid template for you • Restart Apache STRTCPSVR SERVER(*HTTP) RESTART(*HTTP) HTTPSVR(ZENDSVR) • The sample project should run! • http://yourserver:port Alan Seiden Consulting 39 From Zero to ZF on IBM i: Your first Zend Framework project
  • 41. Zend_Tool continues to help • Let’s create a Customer controller • And then an action to show a list of customers  Call it “list” • Once again, launch Studio’s Zend_Tool window • Create the Customer controller: cd /zfdemo zf create controller Customer • Press F5 to refresh, then create the ‘list’ action: zf create action list Customer • Refresh again (F5) Alan Seiden Consulting 41 From Zero to ZF on IBM i: Your first Zend Framework project
  • 42. Our new controller and action are there If you open the CustomerController.php file you will find: public function listAction() { } Alan Seiden Consulting 42 From Zero to ZF on IBM i: Your first Zend Framework project
  • 44. Configure Zend_Db adapter for Db2 At a minimum, create these settings: • adapter type (Db2) • username (may be blank) • password (may be blank) • dbname (may be blank or an entry from WRKRDBDIRE) Run: zf configure db-adapter "adapter=Db2&username=alan&password=secretpw&dbname=*LOCAL" The above zf command creates four keys in application.ini: resources.db.adapter = Db2 resources.db.params.username = "alan" resources.db.params.password = "secretpw" resources.db.params.dbname = "*LOCAL" Alan Seiden Consulting 44 From Zero to ZF on IBM i: Your first Zend Framework project
  • 45. Other useful keys for application.ini ; os="i5" ensures adapter will know we're an IBM i(i5) resources.db.params.os = "i5" ; persistent=true speeds performance resources.db.params.persistent = true ; autocommit=DB2_AUTOCOMMIT_ON for insert/update/delete resources.db.params.driver_options.autocommit = DB2_AUTOCOMMIT_ON ; i5_naming=DB2_I5_NAMING_ON means '/', not '.', is library sep. ; and allows library lists resources.db.params.driver_options.i5_naming = DB2_I5_NAMING_ON ; i5_libl= easy way to specify a library list (see i5_naming above) resources.db.params.driver_options.i5_libl = "LIB1 LIB2" Alan Seiden Consulting 45 From Zero to ZF on IBM i: Your first Zend Framework project
  • 46. Still more optional keys for application.ini ; isDefaultTableAdapter means to use this adapter for tables resources.db.isDefaultTableAdapter = true ;profiler is optional. lets you measure query performance. resources.db.params.profiler.class = "Zend_Db_Profiler_Firebug" resources.db.params.profiler.enabled = true Are we done? No… see the next slide for one more critical step Alan Seiden Consulting 46 From Zero to ZF on IBM i: Your first Zend Framework project
  • 47. Install IBM i-optimized DB2 adapter • As of ZF 1.x, the Db2.php adapter doesn't work quite right for all IBM i's use cases, such as:  DB2_I5_NAMING = On • Because library/schema separator is hardcoded as '.'  Zend_Db_Table performance (metadata retrieval is slow)  Ability to utilize certain .INI settings • I have a temporary fix for you. For ZF 2.x I’ll be working with the ZF team on an official fix. • See next slide for instructions Alan Seiden Consulting 47 From Zero to ZF on IBM i: Your first Zend Framework project
  • 48. Installing my DB2 adapter fix • Download corrected adapter from http://www.alanseiden.com/code/ibm-i-db2-zf-adapter.zip • Extract instructions.txt and Db2.php • Place Db2.php in the folder “library/Strategic/Db/Adapter/” • Note: the “Adapter namespace” (first part of class name) is “Strategic” instead of “Zend.” This can be any name you choose. Alan Seiden Consulting 48 From Zero to ZF on IBM i: Your first Zend Framework project
  • 49. Update application.ini with adapter name • In application.ini, add this setting: resources.db.params.adapterNamespace = Strategic_Db_Adapter • Now you are good to go  In particular, library lists will work Alan Seiden Consulting 49 From Zero to ZF on IBM i: Your first Zend Framework project
  • 51. Zend_Db_Table is one way to access data • Table classes created for us by Zend_Tool • You provide 2 names: 1) class to create 2) table name  Example: I have a table called CUSTFILE  Type “zf create dbtable Custfile CUSTFILE” (if uppercase table)  See resulting class file in screen shot below • Then edit the class, esp. when primary key is not ‘id’ Alan Seiden Consulting 51 From Zero to ZF on IBM i: Your first Zend Framework project
  • 52. Read records using table class In controllers/Customer_Controller.php: public function listAction() { $custfile = new Application_Model_DbTable_Custfile(); $custs = $custfile->fetchAll(); $this->view->customers = $custs; } In views/scripts/customer/list.phtml (omitting the class and style tags): <H1>Customer list from CUSTFILE table</H1> <table class="list"> <tr style="font-weight: bold; text-align: left;"><th>Number</th><th>Name</ th><th>Status</th></tr> <?php $customers = $this->customers; foreach ($customers as $customer) { echo "<tr><td>{$customer->CUSTNO}</td> <td>{$customer->LNAME}</td> <td>{$customer->STATUS}</td></tr>"; } ?> Alan Seiden Consulting </table> 52 From Zero to ZF on IBM i: Your first Zend Framework project
  • 53. Display results • URL: /customer/list Alan Seiden Consulting 53 From Zero to ZF on IBM i: Your first Zend Framework project
  • 54. We did it! • Now you know how to create a Zend Framework project on IBM i that will work on the first try, DB2 and all  ZF version 1.x. For 2.x, see my webcast on Dec. 11, 2012 • These slides are online where you can refer to them • Send me feedback so I can continue to improve the process Alan Seiden Consulting 54 From Zero to ZF on IBM i: Your first Zend Framework project
  • 55. Resources for learning ZF • Tutorials  Official ZF quickstart: http://framework.zend.com/manual/en/ learning.quickstart.html  Rob Allen’s (author of Zend Framework in Action): http:// akrabat.com/zend-framework-tutorial/ • Online training  (Zend) http://shop.zend.com/en/php-training/zend-framework- fundamentals.html • Forums  http://forums.zend.com • User groups (Bring your laptop and ask a question!)  http://framework.zend.com/community/groups Alan Seiden Consulting 55 From Zero to ZF on IBM i: Your first Zend Framework project
  • 57. Alan’s upcoming appearances http://alanseiden.com/presentations/upcoming Oct. 17 Webcast iPro Developer Online Conference Oct. 22-25 ZendCon Santa Clara, Calif. Dec. 11 Webcast Zend Framework 2 and IBM i Alan Seiden Consulting 57 From Zero to ZF on IBM i: Your first Zend Framework project
  • 58. Contact | Get tips Alan Seiden Alan Seiden Consulting Ho-Ho-Kus, NJ alanseiden.com Free tips newsletter: alanseiden.com/tips alan@alanseiden.com ● 201-447-2437 ● twitter: @alanseiden Alan Seiden Consulting 58 From Zero to ZF on IBM i: Your first Zend Framework project