This was a HUGE help! Thank you very much


Larry Kleinman
Kleinman Associates, Inc.
212-949-6469
203-255-4100



"Kelly Cookson" <KCookson@xxxxxxxxxxxx>
Sent by: web400-bounces@xxxxxxxxxxxx
09/09/2009 01:12 PM
Please respond to
Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>


To
"Web Enabling the AS400 / iSeries" <web400@xxxxxxxxxxxx>
cc

Subject
Re: [WEB400] PHP Hello World script using Zend Core for i5






I forgot to mention something: in order to use an SSHD connection from
the Zend Studio to the iSeries, you need to start the SSHD daemon and
create host keys on the iSeries.

Here is a page with detailed instructions on how to do this:
http://kb.zend.com/index.php?View=entry&EntryID=389

You can set up a basic FTP connection instead of an SSHD connection, if
you want. There was a bug in previous versions such that not all
directories would show up using an FTP connection. But that may be fixed
in the newest version of Zend Studio.

Also, you can always use iSeries Navigator to move PHP and HTML files
from your desktop to the Zend Core in the IFS.

Kelly



-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Kelly Cookson
Sent: Wednesday, September 09, 2009 12:00 PM
To: Web Enabling the AS400 / iSeries
Subject: [WEB400] PHP Hello World script using Zend Core for i5

I introduced a few of our programmers to Zend Core i5. We only covered
the most basic information and wrote a couple of hello world scripts. I
hope you find this useful:

See Where Zend Core is Located
1. Open iSeries Navigator. You will need all components of iSeries
Navigator installed so you can
access the IFS.
2. Navigate to /www/zendcore. This is the home of Zend Core.
3. Navigate to /www/zendcore/htdocs. This is where you put all HTML and
PHP files to be
viewed in a browser.

Make Sure the Zend Core is Running
1. Open a browser and navigate to http://myas400:89/.
2. If you see the welcome page, Zend Core is running.
3. If you don't see the welcome page, stop and re-start the Zend Core.
a) Sign on to your as400.
b) Enter the command GO ZENDCORE/ZCMENU.
c) Take option 5 Service Management menu.
d) Take option 9 End i5_COMD service. Wait for messages.
e) Take option 5 Stop Apache server instances. Wait for
messages.
f) Take option 2 Stop Zend Core Subsystem. Wait for
messages.
g) Take option 1 Start Zend Core Subsystem. Wait for
messages.
h) Take option 4 Start Apache server instances. Wait for
messages.
i) Take option 8 Start i5_COMD service. Wait for
messages.

Set Up Zend Studio i5 Edition
1. Register to create an account with Zend:
https://www.zend.com/en/user/login (click on the
"Create a Zend Account" link).
2. Download the Zend Studio i5 Edition:
http://www.zend.com/en/products/studio/downloads
(click the "Zend Studio i5 Edition" radio button and select the "Windows
x86" package).
3. Download and install the studio. Take default options (if any).
4. Sign on to your as400.
5. Enter the command DSPSYSVAL QSRLNBR.
6. Open Zend Studio.
7. Click the "purchase license" link in the Help menu.
8. Use the serial number of your as400 to create a license (say yes to
the email option).
9. Enter your license in Zend Studio.

Create a Personal Development Space
1. Create an SSH Only connection to myas400.
a) Click the Remote Systems tab.
b) Click the "Define a connection to a remote system"
icon.
c) Click the SSH Only option to highlight it, then click
the
Next button.
d) Enter as400 name for host name, connection name, and
description.
e) Click the Finish button. Say yes to creating or
accepting
keys.
2. Click on the new connection and sign in to myas400.
3. Navigate to /www/zendcore/htdocs.
4. Right click on htdocs and select the option to create a new folder
(e.g., myfolder).
5. Open a browser and navigate to your development folder:
http://myas400name:89/myfolder/

Create Hello World Scripts

1. Hello World script. Save as hello_world.php in
/www/zendcore/htdocs/myfolder. To view the page, open a browser and
navigate to http://myas400name:89/myfolder/hello_world.php.

<?php
Print ("Hello, World! This is my first PHP program on the iSeries.");
?>

2. Hello DB2 script. Save as hello_db2.php in
/www/zendcore/htdocs/myfolder. To view the page, open a browser and
navigate to http://myas400name:89/myfolder/hello_db2.php.

<html>
<head></head>
<body>
<table border = "1">
<tr><th>Column Name 1</th><th>Column Name 2</th><th>Column Name
3</th></tr>
<?php
$conn = i5_connect("myas400", "myusername", "mypassword");
$query = i5_query("SELECT * FROM MYLIB/MYFILE");
if($query) {
while ($values = i5_fetch_row($query, I5_READ_NEXT)) {
$row_count++;
print
("<tr><td>$values[0]</td><td>$values[1]</td><td>$values[2]</td></tr>");
}
}
?>
</table>
</body>
</html>

What Next?

Learn the Basics
PHP tutorial: http://www.w3schools.com/php/
PHP Toolkit:
http://files.zend.com/help/Zend-Core-i5-Help/i5_php_api_toolkit.htm
HTML tutorial: http://www.w3schools.com/html/
CSS tutorial: http://www.w3schools.com/css/


Make Use of Zend Resources
Support tickets: http://www.zend.com/support-center/index
(look for "Submit a Support Ticket" in lower right of
page)
Forums: http://forums.zend.com/
(look for PHP ON IBM I forums)
PHP Developer Zone: http://devzone.zend.com/public/view
Documentation Zend Core:
http://files.zend.com/help/Zend-Core-i5/zend-core-i5.htm
Documentation Zend Studio:
http://files.zend.com/help/Zend-Studio-i5/zend-studio-i5.htm

Get the IBM Redbook
PHP: Zend for i5/OS:
http://www.redbooks.ibm.com/abstracts/sg247327.html?Open

-- Kelly

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.