Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

PHP on IBM i Tutorial

9.341 Aufrufe

Veröffentlicht am

Talk by Mike Pavlak of Zend, at ZendCon 2009

Veröffentlicht in: Technologie

PHP on IBM i Tutorial

  1. 1. IBM i Tutorial<br />ByMike Pavlak – Solution Consultant<br />
  2. 2. Introductions<br />Who do we have here?<br />
  3. 3. Who is Mike?<br />IBM i PHP Bigot!<br />Solution Consultant: <br />Techie tagalong – Works w/Account Managers <br />Help account managers develop solutions for customers<br />IBM i advocate<br />COMMON Americas Advisory Council<br />Omni User Group<br />IT Director, Development manager, Consultant, Programmer, Ops…<br />
  4. 4. Who are you?<br />Around the room<br />Name<br />Job Title<br />Company<br />What are you doing with PHP on IBM i?<br />
  5. 5. ZendCon ‘09 – IBM i Events<br />Sessions on Tuesday<br />PHP Faster and Cheaper<br />Sam Hennessy – Zend Technologies<br />Zend Core on IBM i – Security Considerations<br />Tony Cairns – IBM <br />PHP and IBM i - Database Alternatives<br />Erwin Early – IBM<br />Zend Framework on IBM i<br />Alan Seiden – Strategic Business Systems<br />Mazda: Advanced Web Services and PHP<br />Olivier Lépine - Quatrain Technologies<br />
  6. 6. ZendCon ‘09 – IBM i Events (cont.)<br />Lunch<br />Tables will be labeled for i5 community networking<br />Yes you can sit somewhere else <br />IBM i Networking Reception <br />Immediately following the “Meet the Team”<br />Wednesday evening meet in the hall and head out<br />Dinner is on you, but beers are on Zend! <br />Gordon Biersch (note in your bag or see me!)<br />
  7. 7. Review IBM i Product Line from Zend<br />Zend Core (PHP Runtime)<br />Still free <br />Silver support for one year after Feb 2009<br />Zend Studio 7.0 for IBM i (IDE)<br />Still free<br />Basic support for one year after Feb 2009<br />Zend Platform (Box of tools)<br />Annual subscription license<br />Support upgrades available (Throat to choke!)<br />Gold and Platinum<br />
  8. 8. What’s new?<br />Zend Server for IBM i <br />New product that combines features from Core and Platform<br />Single stack for all features<br />Alignment with other platforms!<br />One Apache server, not two! IBM server stays PASE server goes.<br />Still free version for i5 customers (Community Edition)<br />Currently in QA, beta soon GA after that<br />
  9. 9. Current Architecture<br />System i5<br />i5/OS<br />URL: <br />http://myproxy:89/core/registration.php <br />PASE<br />Zend Core<br />PHP file<br />HTTP:89<br />Server<br />(Reverse Proxy)<br />Request<br />HTTP:8000<br />Server<br />Response<br />PHP<br />Module<br />HTML + PHP <br />DB2 UDB<br />Zend <br />Platform<br />
  10. 10. Agenda<br />Toolkit functions<br />Studio Integration<br />Break #1<br />Zend Server<br />Open Source on IBM i<br />Break #2<br />Mix & Match Procedural PHP and Zend Framework<br />
  11. 11. Toolkit functions<br />How we talk to IBM i from PHP Scripts<br />
  12. 12. Toolkit functions to be reviewed<br />Differences between connections<br />System Values<br />Data Area<br />Library List<br />Object Listing<br />Program Call<br />
  13. 13. Survey question<br />How many folks have used i5 functions?<br />Which ones?<br />What are we missing?<br />
  14. 14. Connections, what’s the diff?<br />i5_connect<br />Access OS features <br />Access database features<br />Only available on i5, sorry Linux <br />db2_connect<br />Access database features only<br />Better performance <br />Great for ubiquitous development<br />
  15. 15. Connection successful<br />
  16. 16. Connection error<br />
  17. 17. DB2 Connection<br />Get doc at http://php.net/manual/en/book.ibm-db2.php<br />
  18. 18. DB2 Connection<br />i5 options listed here too! <br />
  19. 19. DB2 Connection: Good<br />
  20. 20. DB2 Connection: Bad<br />
  21. 21. System value<br />Build a “Manager Shortcut” menu<br />Key pieces of info for software installation & BP’s<br />Display via browser<br />
  22. 22. System Value Code<br />
  23. 23. System Value Display<br />
  24. 24. Data Area<br />Use i5 to connect to IBM i<br />DB2 Connect will only take you to the Database<br />
  25. 25. Data Area Access<br />
  26. 26. Library List…<br />I5_connect<br />Get the data area without a library reference<br />
  27. 27. Data Area with library list <br />
  28. 28. Object Listing<br />Given a library<br />Show objects in the library<br />Think of the list of objects as a result set from SQL<br />Standard aproach<br />Create list<br />Read list<br />This works for spooled files, active jobs, etc.<br />
  29. 29. Object listing code<br />
  30. 30. Object list output<br />
  31. 31. A brief word about CSS<br />Cascading Style Sheets<br />Very powerful in maintaining consistent look and feel of elements across applications<br />Will continue to use sample.css through presentation <br />
  32. 32. Studio Integration<br />How Zend Platform works…<br />
  33. 33. Debugging for the rest of us…<br />Very few slides<br />Lots of demo<br />Debug<br />Platform<br />More…<br />
  34. 34. Debug rules<br />Must use port 8000!<br />Tunnel helps a LOT<br />Browser integration<br />We’ll look at configuring debug in Zend Studio<br />Then look at Zend Platform integration!<br />
  35. 35. Break <br />Be back in 10 minutes<br />
  36. 36. Zend Server for IBM i<br />The next generation of the Zend Stack for IBM i<br />
  37. 37. The next generation of IBM i Zend Stack<br />Improvements:<br />Faster, How fast? I can’t tell you…but it is faster!<br />One less Apache server (Yay!)<br />More powerful JOBQ function<br />Alignment with the other product lines<br />Lot’s of tweaks and enhancements<br />Private Beta starting soon<br />Public beta immediately afterward<br />
  38. 38. Open Source on IBM i<br />A quick look at PHPMyAdmin<br />
  39. 39. Number 2 reason folks look at PHP on IBM i<br />Agenda<br />Explore benefits of open source on IBM i<br />Ponder a short list of popular applications <br />Examine the components for installation<br />Review the installation steps<br />Walk through a live implementation<br />
  40. 40. phpMyAdmin<br />Fabulous utility for accessing MySQL Data on ANY platform<br />Written completely in PHP<br />You must have MySQL installed<br />Runs on IBM i…but…<br />…not supported on IBM i<br />DBU for MySQL!<br />
  41. 41. What we will do with phpMyAdmin<br />Demo the product<br />Walk through the install steps<br />Demo a live installation<br />
  42. 42. phpMyAdmin<br />Demo…<br />http://cuper1.zend.com:89/phpmyadmin<br />Tour MIKEY1<br />Create table<br />More features<br />
  43. 43. phpMyAdmin – Installation process<br />Pre-requisties:<br />Zend Core for i5/OS<br />MySQL version 5 or greater<br />V5R4 or V6R1<br />Agenda<br />Get file<br />Move to IBM i<br />Un-tar<br />Configure<br />Play<br />
  44. 44. Get phpMyAdmin file to IBM i<br />Go to the host website, download current version<br />http://www.phpmyadmin.net<br />Click Download at top of screen<br />Select version appropriate for you, I chose English tar.gz<br />
  45. 45. Compression<br />Compression and archive…<br />TAR was done first<br />Then GZIP was done. <br />So….<br />You need to work in reverse<br />Unzip the file on your workstation (PKZip, etc.)<br />Move the file phpMyAdmin-3.2.2-english.tar to the IFS doc root<br />Then untar on the i5<br />
  46. 46. Place file into document root<br />
  47. 47. Command to untar<br />Tar = Tap Archive<br />Use QP2TERM interfac to untar<br />Call QP2TERM<br />Change to the document root<br />CD /www/zendcore/htdocs<br />
  48. 48. Open PASE Shell<br />
  49. 49. Open PASE Shell<br />
  50. 50. After the tar<br />The screen will roll quite a bit then you get the $<br />Now create a symbolic link to the directory for ease of use<br />ln -s ./phpMyAdmin-3.2.2-english phpMyAdmin<br />
  51. 51. Create the config file<br />The config file tells phpMyAdmin where everything is. <br />Create manually<br />Use automated feature<br />Move to the phpMyAdmin directory<br />cdphpmyadmin<br />Create the directory & set security<br />mkdirconfig<br />chmodo+rwconfig<br />
  52. 52. Results of directory and security changes<br />
  53. 53. Go to browser to run config<br />http://your_host/path/to/phpMyAdmin/setup/<br />
  54. 54. Scroll down to config options<br />Click the New server button…<br />
  55. 55. Enter server specific info<br />Type a description of the server name<br />Leave localhost for hostname…click SAVE<br />
  56. 56. Finish options<br />Select language, etc. And click save again<br />
  57. 57. Copy the config file to phpMyAdmin directory<br />You just created a config file in directory config<br />Move the file to the phpMyAdmin directory for use<br />mvconfig/config.inc.php .<br />chmod o-rwconfig.inc.php<br />
  58. 58. Head to the phpMyAdmin login screen<br />http://yourservername/phpMyAdmin/<br />
  59. 59. Add user to MySQL<br />cd /usr/local/mysql/bin<br />Mysql –u root<br />use mysql<br />select user, password from user;<br />
  60. 60. Before the addition<br />
  61. 61. After the addition<br />Add the user:<br />CREATE USER ‘mpavlak&apos;@‘%&apos; IDENTIFIED BY ‘test1&apos;;<br />GRANT SELECT,INSERT,UPDATE,DELETE ON *.* TO ‘mpavlak&apos;@’%’;<br />Or<br />GRANT ALL ON *.* TO ‘mpavlak&apos;@’%’;<br />
  62. 62. And we’re in!<br />
  63. 63. Break <br />Be back in 10 minutes<br />
  64. 64. Mix & match<br />Procedural PHP & Zend Framework<br />
  65. 65. Procedural PHP and Zend Framework<br />Agenda<br />Look at a procedural PHP application that gets order info<br />Look at the info in a web page<br />Move info to PDF and distribute<br />Think ZF is hard? Guess again!<br />
  66. 66. Zend_PDF<br />Check out the Zend Framework website<br />http://www.zendframework.com/manual/en/zend.pdf.html<br />Look at an example that reads DB2 data and produces a PDF<br />
  67. 67. Agenda<br />Read order detail file<br />Instantiate a PDF object<br />Update the object with the contents of the order<br />Write the PDF<br />Dispose of the object<br />Admire our work!<br />
  68. 68. Zend_PDF<br />Component of Zend Framework<br />Comes with Zend Core for i5<br />FREE!!!<br />ZF is built by the community, for the community<br />Documentation at: http://framework.zend.com/manual/en/zend.pdf.html<br />
  69. 69. Build the content<br />Read through the detail file…<br />
  70. 70. Object & heading<br />Create object <br />Set heading<br />
  71. 71. Body of print<br />Develop line detail <br />Output the PDF o the IFS<br />
  72. 72. Windows Explorer view of IFS<br />Once in the IFS you do what you want<br />FTP, email, cms, etc…<br />
  73. 73. The PDF!<br />
  74. 74. Zend_PDF Documentation<br />Check out Zend_PDF doc at ZendFramework.com<br />Make it look pretty<br />Integrate into procedural development<br />Learn a little OO as you go<br />Come to Zend for more training<br />Higher Structures<br />Zend Framework<br />Certification prep<br />More…<br />
  75. 75. Where to get more information<br />Zend and other places<br />
  76. 76. Free code!<br />PHPClasses.org<br />Hotscript.com<br />Sourceforge.net<br />Php.net<br />Thefreecountry.com/php<br />
  77. 77. Support<br />Zend.com<br />Forums<br />Knowledgebase<br />Webcasts<br />Downloads <br />Developer Zone<br />Product information & documentation<br />Paid products<br />
  78. 78. New book, new printing, same great stuff!<br />Kevin Schroeder from Zend’s Global Services Group<br />with <br />Jeff Olen, co-author of…<br />Get yours at MCPressonline<br />or at fine bookstores everywhere<br />
  79. 79. Mike’s blog!<br />http://mikepavlak/blogspot.com<br />Aggregated at http://planet-i.org/<br />
  80. 80. IBM i Events…reminder!!!<br />Sessions on Tuesday<br />PHP Faster and Cheaper<br />Sam Hennessy – Zend Technologies<br />Zend Core on IBM i – Security Considerations<br />Tony Cairns – IBM <br />PHP and IBM i - Database Alternatives<br />Erwin Early – IBM<br />Zend Framework on IBM i<br />Alan Seiden – Strategic Business Systems<br />Mazda: Advanced Web Services and PHP<br />Olivier Lépine - Quatrain Technologies<br />
  81. 81. IBM i Events (cont.)<br />Lunch<br />Tables will be labeled for i5 community networking<br />Yes you can sit somewhere else <br />IBM i Networking Reception <br />Immediately following the “Meet the Team”<br />Wednesday evening meet in the hall and head out<br />Dinner is on you, but beers are on Zend! <br />Gordon Biersch (note in your bag or see me!)<br />
  82. 82. Please enjoy the Conference!<br />Thank you!!!<br />

×