You’ve successfully installed the Zend Core for i5. Now what? The process of developing PHP scripts may not be obvious to System i developers familiar with RPG and COBOL. Let’s take a look at the basic steps needed to start writing PHP scripts on System i.
See Where Zend Core is Located
- Open iSeries Navigator. You will need all components of iSeries Navigator installed so you can access the IFS.
- Navigate to /www/zendcore. This is the home of Zend Core.
- 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
- Open a browser and navigate to http://myas400name:89/. Replace myas400 with either the network name or the URL of your System i.
- If you see the welcome page, Zend Core is running.
- If you don’t see the welcome page, stop and re-start the Zend Core.
- Sign on to your System i.
- Enter the command GO ZENDCORE/ZCMENU.
- Take option 5 Service Management menu.
- Take option 9 End i5_COMD service. Wait for the messages.
- Take option 5 Stop Apache server instances. Wait for messages.
- Take option 2 Stop Zend Core Subsystem. Wait for messages.
- Take option 1 Start Zend Core Subsystem. Wait for messages.
- Take option 4 Start Apache server instances. Wait for messages.
- Take option 8 Start i5_COMD service. Wait for messages.
- You don’t always need to stop all three services and then re-start them. When you become more familiar with the services, you can start and stop each service as needed.
Set Up Zend Studio i5 Edition
- Register to create an account with Zend: https://www.zend.com/en/user/login. Click on the “Create a Zend Account” link.
- 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.
- Download and install the studio. Take default options (if any).
- Sign on to your System i.
- Enter the command DSPSYSVAL QSRLNBR.
- Open Zend Studio.
- Click the “purchase license” link in the Help menu.
- Use the serial number of your System i to create a license (say yes to the email option).
- Enter your license in Zend Studio.
Set Up Your System i for SSH Connections
You can get detailed instructions for setting up SSH at http://kb.zend.com/index.php?View=entry&EntryID=389. You can also find the instructions by going to the Zend Support Center and searching for “SSH i5″.
Create a Personal Development Space
- Create an SSH Only connection to myas400.
- Click the Remote Systems tab.
- Click the “Define a connection to a remote system” icon. Or, you can right click inside the Remote Systems area and choose “New Connection.”
- Click the SSH Only option to highlight it, then click the Next button.
- Enter your System i name for host name, connection name, and description. You might need to use a URL if your network doesn’t recognize your System i by name.
- Click the Finish button. Say yes to creating or accepting keys.
- Click on the new connection and sign in to your System i.
- Navigate to /www/zendcore/htdocs.
- Right click on htdocs and select the option to create a new folder (e.g., myfolder).
- Open a browser and navigate to your development folder: http://myas400name:89/myfolder/
Create Hello World Scripts
Hello World Script. Save this script 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 script on the System i.");
?>
Hello DB2 script. Save this script 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. Obviously, the script provided here is only a template.
<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("myas400name", "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
Check Out the WEB400 List
- Search the archives: http://archive.midrange.com/web400/
- Join the list: http://lists.midrange.com/mailman/listinfo/web400
Get the IBM Redbook
- PHP: Zend for i5/OS: http://www.redbooks.ibm.com/abstracts/sg247327.html?Open




November 6, 2009 at 7:53 pm
thanks very much.
January 25, 2010 at 8:31 pm
I See i can expabd my knowledge got in http://phpforms.net/tutotials
January 26, 2010 at 3:05 pm
I meant <a href="http://phpforms.net/tutorial.html">http://phpforms.net/tutorial.html/</a>