Top 10 Reasons to Choose PHP for IBM I Web Application Development
Total Page:16
File Type:pdf, Size:1020Kb
Top 10 Reasons to Choose PHP for IBM i Web Application Development Read this eBook to learn why PHP is a great application modernization choice for IBM i shops Table of Contents Executive Summary 0 3 What Is PHP? 0 4 1 Popularity 06 2 Open Source, Low Cost 08 3 PHP Is Easy for IBM i Programmers to Learn 09 4 Use Existing Staff and Attract New Talent 1 3 5 Leverage RPG, DB2 and IBM i Features 1 4 6 IBM i, PHP and Mobile Devices 17 7 Powerful Language Features 19 8 Available Ecosystem of Tools 2 2 9 APIs and Web Services 2 4 10 PHP Is Supported by IBM, Zend and BCD 2 6 Why WebSmart PHP? 2 7 Why Zend Server? 3 0 About the Author 3 1 CREATED BY THE FOLLOWING BCD AND QUADRANT SOFTWARE EMPLOYEES: Writer: Duncan Kenzie, Chief Editor: Candice Schultz, Brand Manager Knowledge Officer Designer: Menno van Mil, Design Manager TOP 10 REASONS TO CHOOSE PHP FOR IBM i WEB APPLICATION DEVELOPMENT 02 Executive Summary The need for IBM i modernization grows more imperative each year as organizations face increased costs for maintaining legacy applications, training end users and hiring from a shrinking pool of RPG programmers When deciding on your modernization strategy, it’s important to choose technologies and tools that are easy for RPG programmers to learn They should also grow with technologies like mobile and whatever else the future holds PHP, one of the world’s most popular web development languages, gives you all of this and more It’s also open source and supported by IBM and Zend, which enables you to leverage your IBM i and proven RPG code This eBook is written for people who are considering PHP and web development in general and have experience with IBM i or programming in business languages such as RPG or COBOL It outlines the top 10 reasons why you should choose PHP for your next IBM i web development project TOP 10 REASONS TO CHOOSE PHP FOR IBM i WEB APPLICATION DEVELOPMENT 03 What Is PHP? PHP is a language that was created specifically to deliver dynamic web pages and interact with web servers Initially, its main purpose was to make it easier to build static web pages using templating ideas But it quickly evolved into a full-blown language, capable of producing database-driven business applications as powerful and complex as any Java, Net or RPG applications you might have encountered Although PHP started life as a ‘scripting’ language (meaning it was interpreted on the fly each time a user accessed a PHP page), today it can also be compiled, ensuring scalability and performance as your applications grow in use We’ll discuss this concept later in this eBook Comparing PHP to RPG, you can think of it as focusing on interactive programming However, you can also run PHP programs in a ‘command line interface,’ which is analogous to batch programming with RPG This is useful for running tasks that don’t require user intervention, such as periodically sending emails to customers PHP has been supported by Zend and IBM since it was brought to TOP 10 REASONS TO CHOOSE PHP FOR IBM i WEB APPLICATION DEVELOPMENT 04 What Is PHP? IBM i in 2006 and is now one of the world’s1 fastest growing server- side language It continues to evolve at a rapid rate and version 7 was recently released This is a major new release of the language and includes significant performance improvements - anywhere from 25% to 70% on real-world applications PHP is typically used as part of a ‘stack’ - a suite of software products that provide a complete solution for web application development and deployment You may have seen the acronym LAMP stack, for example This refers to Linux, Apache, MySQL and PHP Linux is the operating system, Apache is the web server software, MySQL is the database and PHP is the programming language that exploits all three of these On IBM i, you might see the acronym iADP, which simply means i/OS is the operating system on which Apache, IBM DB2 and PHP run, versus Linux and MySQL It’s important to note that you can also use MySQL on IBM i We’ll discuss this further in reason #5, Leverage RPG, DB2 and IBM i Features, on page 14 1 Source: w3techs com, 2016 TOP 10 REASONS TO CHOOSE PHP FOR IBM i WEB APPLICATION DEVELOPMENT 05 1 Popularity PHP is the most popular web development language and platform in use today 82% of the world’s websites1 use PHP to drive their applications, whether it be for personal blogs or for full-blown enterprise applications Almost 22% of the 834 IBM i organizations % that completed HelpSystems’ 2016 IBM i Marketplace Survey use 2 82 PHP for new development of the world’s websites use PHP. Major sites like Twitter, Yahoo! and Wikipedia use PHP extensively It also runs a wide variety of application domains, including content management, ecommerce and ERP applications such as Magento Some major open-source (free or commercially licensed) products 82 are built with PHP and many of them can run on IBM i For example, Wordpress, a popular blogging and content management platform, is written in PHP You can install Wordpress on your own IBM i server and run it in-house, or you can create an account at Wordpress com and run it there, in the cloud Other popular packages include Drupal and Joomla! (content management systems), mediawiki % (the software that drives Wikipedia) and SugarCRM, a customer 22 relationship management solution of IBM i organizations use PHP. 1 Source: w3techs com, 2016 2 Source: HelpSystems, 2016 22 TOP 10 REASONS TO CHOOSE PHP FOR IBM i WEB APPLICATION DEVELOPMENT 06 1 Popularity PHP’s popularity is partly due to the ease of entry in developing and deploying it Most servers have PHP installed out of the box and there is little configuration effort required in order for you to start using it And, as we discuss in a later section, the language is easy to learn and be productive in quickly Also, contrary to what you might have heard (especially from proponents of ‘compiled’ languages such as Java or ASP net), PHP’s performance and scalability are excellent As you can imagine, a site like Wikipedia cannot afford to have slow-running code, given the high number of users and activity on the site at any point in time TOP 10 REASONS TO CHOOSE PHP FOR IBM i WEB APPLICATION DEVELOPMENT 07 2 Open Source, Low Cost PHP is low cost and open source This means that it’s maintained and enhanced by an organization of volunteers and commercial entities For example, Zend, which was founded by two of the early authors of PHP, invests heavily in improving PHP The language is written entirely in C, so anyone with C programming skills can contribute to the PHP codebase You’ll also notice that the community of open source developers is large and very active so you can readily find code samples and help online Another advantage of PHP being open source is that you can run it on almost any operating system and/or hardware platform, including Windows, Linux, Unix, Mac/OS and IBM i The version of PHP running on IBM i is actually a superset of the other platforms, as it includes additional functionality to support native IBM i operating system features and the IBM DB2 database You can start developing with PHP using the basic implementation or deploy the open-source packages mentioned earlier at no cost As your needs increase (or if you’re running mission-critical applications) you may want to deploy Zend’s Professional or Enterprise Server on your IBM i, which provides additional stability, performance and scalability TOP 10 REASONS TO CHOOSE PHP FOR IBM i WEB APPLICATION DEVELOPMENT 08 3 PHP Is Easy for IBM i Programmers to Learn Whether you’re an RPG or COBOL programmer, you’ll likely find PHP easy to learn In fact, you can write a ‘hello world’ program in just one executable line, like so: <?php echo ‘hello world!’; ?> This simply prints the words ‘hello world’ in your browser Unlike Java, you don’t have to write everything as object-oriented PHP Instead, you can begin writing PHP using a procedural coding style This means that you can use concepts that are already familiar to you to construct your code TOP 10 REASONS TO CHOOSE PHP FOR IBM i WEB APPLICATION DEVELOPMENT 09 3 PHP Is Easy for IBM i Programmers to Learn Here’s a chart of some similarities between RPG and PHP: RPG PHP Free-format C specs (lines end with ;) All code is free-format Lines end with ; Control blocks: IF (cond) / IFEND IF ( cond ) { } Database files and embedded exec-SQL IBM_DB2 connection on IBM i, and PHP statements Data Objects – a cross-platform interface to many SQL implementations, not just MySQL IFS Files (via API calls) Stream files Input from user (EXFMT, CGI input) Request variables Output to User (EXFMT or CGI output) echo or print (generally to Web page) D Specs for fields and arrays var declarations Variable scope - global, local in module, Same (plus scope within objects) local in subprocedure /COPY directives to include common code Includes Batch programming (no user interaction) CLI (Command Line Interface) PHP Subroutines and Procedures Functions RPG Modules and Service programs includes or objects (more advanced approach) TOP 10 REASONS TO CHOOSE PHP FOR IBM i WEB APPLICATION DEVELOPMENT 10 3 PHP Is Easy for IBM i Programmers to Learn Although the syntax of PHP is quite different from RPG in some areas, the concepts are very similar Areas of particular importance, such as database access, are in many ways easier than in RPG For example, substituting variables into a dynamic SQL string is very simple, and writing SQL statements is not cumbersome as you are not constrained by the length of each line of code as you are in IBM i source files