How To Start Up With Php In Ibm I

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    How To Start Up With Php In Ibm I - Presentation Transcript

    1. How to Start up with PHP in IBM i June, 2007 Sam Pinkhasov Project Manager for IBM products [email_address]
    2. Agenda
      • First steps
      • Accessing DB2/400
      • PHP Toolkit for i5/OS
      • 5250 Bridge
      • PHP is ready for production by OpeniVew
      • Q&A
    3. Zend Platform with 5250 Bridge IBM i DB2/400 Pgm, CMD, Spooled file Database Business Zend Studio Zend Core with Toolkit APIs Apache webserver Zend PHP Products for IBM I Diagram Zend Guard Windows/Linux Browser
      • Setting up PHP in IBM i
      • Verify installation
      • Setup debug in Zend Studio and Zend Core
      • Write a simple PHP code
      First Steps
      • Install Zend Core
        • Requirements
          • 5722SS1 - - PASE Option (Option 33)
          • 5733SC1 - IBM Portable Utilities For I5/OS (Option *BASE)
          • 5733sc1 - OpenSSH ,OpenSST,Zlib (Option 1)
        • Download Zend Core for i5/OS from Zend Network
          • http://www.zend.com/products/zend_core/zend_core_for_i5_os
        • Install
          • RSTLICPGM LICPGM(1ZCORE5) DEV(*SAVF) SAVF(QGPL/ZCORESAVF)
          • SBMJOB (RSTLICPGM LICPGM(1ZCORE5) DEV(*SAVF) SAVF(QGPL/ZCORESAVF)
      • Install Zend Studio Eclipse Edition for i5/OS
        • Download from Zend Network
        • Install
        • Registration
      Install Zend Core and Zend Studio
    4. Setting up PHP in IBM i
      • Requirements
        • 5722SS1 - PASE Option (Option 33)
        • 5733SC1 - IBM Portable Utilities For I5/OS (Option *BASE)
        • 5733sc1 - OpenSSH ,OpenSST,Zlib (Option 1)
      • Download Zend Core for i5/OS from zend.com
        • RSTLICPGM installation
        • Creates the ZENDCORE library, /usr/local/Zend directory, and Zend-specific user profiles
      • Start the Zend subsystem and the HTTP servers
        • GO ZENDCORE/ZCMENU
        • Option 5 (Service Management menu)
        • Option 1 (Start Zend Core subsystem) or Option 4 (Start Apache server instances)
    5. Setting up PHP in IBM i
      • Download Zend Studio for i5/OS from zend.com
        • Integrated development environment
        • Runs on Windows and Linux
      • Start Zend Core console : http://i5_server:89
      • Run WRKACTJOB SBS(ZEND) CL command
      • Run PHP demo application installed with the product
      Installation verification
    6. Zend Core Console http://i5_server:89
    7. Zend Subsystem – wrkactjob sbs(Zend)
      • Run Zend Navigator demo application
          • URL: http://i5_server:89/Zend_Navigator_Demo/login.php
      Run PHP Application The demo application sources are available in www/zendcore/htdocs/Zend_Navigator_Demo .
    8. Run Zend Navigator http://i5_server:89/Zend_Navigator_Demo/login.php
    9. Zend Core – Debug Set Up
    10. Zend Core – Restart Apache
      • GO ZENDCORE/ZCMENU
    11. Zend Studio - Debug Set Up
    12. Writing a simple PHP code
      • Map IFS directory /www/zendcore/htdocs to Windows driver
      • Start Zend Studio
      • Start project wizard: New->Project
      • Select Windows mapped IFS drive
      • Write the following code
        • <?php
        • echo phpinfo();
        • ?>
      • Save as test.php
      • Run http://i5_server:89/test.php
    13. Writing a simple PHP code
    14. Running PHP command line
      • From the default PASE shell.
        • call qp2term
          • /usr/local/Zend/core/bin/php-cli -help
      • From the System i command line (or CL program)
        • CALL PGM(QP2SHELL) PARM('/usr/local/Zend/core/bin/php-cli' '-help')
      • From QSH.
        • QSH
          • /usr/local/Zend/core/bin/php-cli –help
      • Example:
        • /usr/local/Zend/core/bin/php-cli /usr/local/Zend/apache2/htdocs/DB2_example.php
    15. Accessing DB2/400
      • Server/connection
        • db2_bind_param
        • db2_client_info
        • db2_close
        • db2_connect
        • db2_cursor_type
        • db2_exec
        • db2_execute
        • db2_prepare
        • db2_pconnect
        • db2_server_info
        • db2_statistics
      • Result
        • db2_free_result
        • db2_next_result
        • db2_result
      • Commit/Rollback
        • db2_autocommit
        • db2_commit
        • db2_rollback
      • Errors
        • db2_conn_error
        • db2_conn_errormsg
        • db2_stmt_error
        • db2_stmt_errormsg
      • Column/Procedure
        • db2_column_privileges
        • db2_columns
        • db2_procedure_columns
        • db2_procedures
        • db2_special_columns
      • Table information
        • db2_num_fields
        • db2_num_rows
        • db2_table_privileges
        • db2_tables
      • Fetch
        • db2_fetch_array
        • db2_fetch_assoc
        • db2_fetch_both
        • db2_fetch_object
        • db2_fetch_row
      • Field information
        • db2_field_display_size
        • db2_field_name
        • db2_field_num
        • db2_field_precision
        • db2_field_scale
        • db2_field_type
        • db2_field_width
      • Key information
        • db2_foreign_keys
        • db2_primary_keys
      • Statement
        • db2_free_stmt
      • There are few connections options in PHP
        • db2_connect(“”,””,””) – local server
          • The database connection job is create under the same user as the Apache httpd server profile NOBODY (*USER).
        • db2_connect(“127.0.0.1&quot;, “SAM&quot;, “PASSWROD&quot;) – local server
          • The database connection job is created under the user profile SAM/PASSWROD.
        • db2_connect(“10.1.1.33&quot;, “SAM&quot;, “PASSWROD&quot;) – remote remote database connection job is created under the user server
          • The profile SAM/PASSWROD.
      Server connection – db2_connect API
        • Tip: Use WRKRDBDIRE to get the database name on the remote
      • DB2 functions
          • db2_connect – Connects to server
          • db2_prepare – Prepares an SQL statement
          • db2_bind_param – Binds the an SQL statement
          • db2_execute – Executes an SQL command
          • db2_fetch_array – Reads records
      • View attached program DB2_example.php
      Sample code accessing database
    16. Program Result http://i5_server:89/DB2_example .php
    17. Recommendations
      • CCSID = 65535
        • PHP scripts getting “junk” back from their DB2 SQL queries. Root problem is often QCCSID setting 65535 (binary default from manufacturing)
        • Change CCSID before starting Apache
          • signon as QSECOFR
          • GO ZENDCORE/ZCMENU -> stop apache
          • CHGJOB LANGID(ENU) CNTRYID(US) CCSID(37)
          • GO ZENDCORE/ZCMENU -> start apache
      • Journaling (transactions)
        • php.ini setting ibm_db2.i5_allow_commit=0 is the default.
        • If all of your schemas/libraries have journal enabled change php.ini to ibm_db2.i5_allow_commit=1
    18. Other File Functions
      • PHP has number of functions allowing access and update information contained in flat files and streams on IBM i.
        • Open, read, write and close a flat file
          • fopen ()
          • fclose ()
          • fread ()
          • fwrite ()
        • Read a CSV file
          • fgetcsv()
      Look it up in the PHP manual to see files examples .
    19. PHP Toolkit for i5/OS
      • Bundled with Zend Core
      • Geared towards accessing data and resources from PHP
        • Programs and/or service programs
        • Data Queue
        • CL commands
        • Spooled files
        • Record-level file access
        • User Space
    20. PHP Toolkit for i5/OS – list of functions
      • Connection management
        • i5_connect
        • i5_pconnect
        • i5_close
        • i5_pclose
        • i5_adopt_authority
        • i5_error
        • i5_errno
        • i5_errormsg
      • Command calls
        • i5_command
      • Program calls
        • i5_program_prepare
        • i5_program_prepare_PCML
        • i5_program_call
        • i5_program_close
      • Data retrieval
        • i5_fetch_array
        • i5_fetch_assoc
        • i5_fetch_object
        • i5_fetch_row
        • i5_info
        • i5_field_len
        • i5_field_name
        • i5_field_scale
        • i5_field_type
        • i5_list_fields
        • i5_num_fields
        • i5_result
      • Native file access
        • i5_open
        • i5_addnew
        • I5_edit
        • I5_delete
        • i5_cancel_edit
        • i5_setvalue
        • i5_update
        • i5_range_from
        • i5_range_to
        • i5_range_clear
        • i5_data_seek
        • i5_seek
        • i5_bookmark
        • i5_free_file
        • i5_new_record
        • i5_update_record
        • i5_get_keys
      • SQL access
        • I5_query
        • I5_prepare
        • i5_bind_result
        • i5_execute
        • i5_getblob
        • i5_setblob
      • Transactions
        • i5_transactions
        • i5_commit
        • i5_rollback
    21. PHP Toolkit functions
      • System values
        • i5_get_system_value
      • Data areas
        • i5_data_area_prepare
        • i5_data_area_receive
        • i5_data_area_send
        • i5_data_area_close
      • Print/Get spooled file
        • i5_spool_list
        • i5_spool_list_read
        • i5_spool_list_close
        • i5_spool_get_data
        • i5_spool_from_file
      • Job logs
        • i5_jobLog_list
        • i5_jobLog_list_read
        • i5_jobLog_list_close
      • Active jobs
        • i5_job_list
        • i5_job_list_read
        • i5_job_list_close
      • Objects list
        • i5_object_list
        • i5_object_list_read
        • i5_object_list_close
      • User space
        • i5_userspace_crearte
        • i5_userspace_prepare
        • i5_userspace_get
        • i5_userspace_put
      • Data Queue
        • i5_dtaq_prepare
        • i5_dtaq_recieve
        • i5_dtaq_send
        • i5_dtaq-close
      • RPG program
      Sample code calling an RPG program
      • PHP Toolkit functions
          • I5_connect – opens server connection
          • i5_program_prepare – defines the program parameters
          • i5_program_call – calls a program
          • i5_program_close – clears program handles
          • i5-_close – closes server connection
      Sample code calling an RPG program
    22. PHP Toolkit Resources
      • Zend Core User Guide
        • Zend Core for i5/OS product page – http://www.zend.com/products/zend_core/zend_core_for_i5_os
        • Zend Core installation directory - /usr/local/Zend/ Zend_Core_User_Guide_i5OS.pdf
    23. PHP Toolkit Templates
      • PHP Toolkit Templates are available in Zend Studio
        • RAD
        • Error free code
        • Good learning tool
        • Code standardization
        • Create your company specific logic
      • How to access?
        • Toolkit templates list - Window -> Preference -> Templates
        • Import/Export
      • Documentation
        • Zend Core and Zend Studio User Guide
    24. Product Definition
        • The 5250 Bridge is a PHP based solution for running interactive applications in the i5/OS environment
      |
    25. Technical Overview
      • PHP library containing set of PHP functions/classes accessing 5250 data stream allowing to run any 5250 interface/applications in PHP
        • Utilizing IBM WebFace server – part of i5/OS TCP/IP
        • All screen information available:
          • Input and Output fields and attributes
          • Format name
        • Maintainable 5250 session
        • No Java
      |
    26. | 5250 Bridge Diagram
    27. | Demo Program – Subfile Application
    28. Resources: Books
      • Sklar, David. Learning PHP 5 . O'Reilly Media, Inc. 2004.
        • http://www.oreilly.com/catalog/learnphp5/
      • Kelly, Brian. Getting Started with PHP for i5/OS, MC Press
        • http://www.mc-store.com/5934.html
      • Jeff Olen , Kevin Schroeder, The IBM i Programmer's Guide to PHP
        • http://www.mc-store.com/5096.html
      • PHP: Zend for i5/OS
        • Redbook SG24-7327-00 http://www.redbooks.ibm.com/abstracts/sg247327.html
    29. Resources: Web sites
      • PHP documentation at php.net
        • http://www.php.net/docs.php
      • DB2 documentation
        • http://phpbuilder.com/manual/en/ref.ibm-db2.php
      • Zend and i5/OS
        • Overview, benefits, products, getting started
        • http://www-03.ibm.com/systems/i/software/php/
      • ReadWiki – online documentation
        • http://www-941.ibm.com/collaboration/wiki/display/sg247327/Home
      • PHP for i5/OS forums – discussion groups
        • http://www.zend.com/forums
    30. Resources : Web sites
      • Zend Developer Zone - Tutorials
        • http://devzone.zend.com/public/view/tag/tutorials
        • “ Integrating PHP Using Web Services” http://www.ibmsystemsmag.com/i5/april07/tipstechniques/12365p1.aspx
      • Tips
        • Installing Zend Core - http://www.mcpressonline.com/mc?50@252.8sVbe2ZbLxe.1@.6b507b23
        • Use PHP to Bring i5/OS Resources to the Web
          • http://www.itjungle.com/fhg/fhg103107-story01.html
          • http://www.itjungle.com/fhg/fhg011608-story01.html
    31. Resources: Sample Code
      • Check out the thousands of PHP scripts available that can be used as-is or as the starting point for Web projects .
        • http://www.hotscripts.com
        • http://www.phpjunkyard.com/
        • http://www.phpfreaks.com/
        • http://phpfreebies.com/

    + Alex FrenkelAlex Frenkel, 5 months ago

    custom

    576 views, 0 favs, 0 embeds more stats

    Presentation about how to start up with PHP on IBM more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 576
      • 576 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 12
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories