Understanding and Managing the PHP Environment on IBM i

ERWIN EARLEY (EEARLEY@.COM), SR. SOLUTIONS CONSULTANT, PERFORCE

1 | by Perforce © Perforce Software, Inc. Zend by Perforce © Perforce Software, Inc. zend.com Today’s Speaker #1

Erwin Earley offers more than 20 years of experience developing solutions on the IBM i platform. His expertise includes using PHP, MariaDB, Docker, and Chef for creating modern enterprise solutions that run on IBM i, as well as PowerVC for cloud deployments and virtualization management. Erwin Earley Mr. Earley is a frequent speaker at global technology conferences, and he has authored numerous articles on Linux, Senior Solutions Consultant, PHP, virtualization, and systems management. Zend by Perforce

2 | Zend by Perforce © Perforce Software, Inc. zend.com Agenda

1 Product Update 7 Practical PHP

2 Community PHP 8 PHP 7.4 Highlights

3 Zero to Zend – One and Done 9 PHP 8

4 Characteristics of the PHP Environment 10 Backup Materials – Application Server Makes Life Easier!

5 Managing the PHP Jobs/Environment

6 Managing the PHP Runtime Experience

3 | Zend by Perforce © Perforce Software, Inc. zend.com Product Updates

4 | Zend by Perforce © Perforce Software, Inc. zend.com Where We’ve Been – Adoption of PHP on IBM i • IBM & Zend meet… • SystemiNetwork, COMMON, etc., identify need for scripting on IBM i • Zend CEO and VP of Business Development come to COMMON

• IBM & Zend Dance • IBM and Zend strike a BP-relationship in 2006 • IBM helps Zend port PHP to IBM i

• Seeding the Marketplace • IBM provides 1 year of "silver" support to every IBM i customer via Zend Basic License • Zend Basic intended for POCs, not production implementations

5 | Zend by Perforce © Perforce Software, Inc. zend.com Where We Are

• PHP is a strategic platform/solution in many IBM i shops • Estimated 50% of IBM i customers have implemented PHP • PHP is heavily used in customer developed solutions, LAMP-based solutions, and ISV-provided solutions

• PHP supports three (3) approaches to modernization • Augmentation of existing solutions • Development of new solutions • Implementation of enterprise-ready productivity solutions

6 | Zend by Perforce © Perforce Software, Inc. zend.com Where we are Going • IBM has announced End-of-Life (EOL) for their offering of one (1) year of free "silver" support • EOL takes affect 30-June-2020 • New customers (customers who have not previously registered for their one (1) year of free "silver" support will be able to continue to register past 30-June-3030; however, all free "silver" support ends on 30-June-2021)

• In conjunction with IBMs announcement, Zend by Perforce has announced the end of Zend Server Basic licensing • Dates coincide with IBM's "silver" support dates

• Does this mean that Zend Server is going away • Absolutely not!! • Zend Server will continue to be offered with the Professional and Enterprise licenses and will continue to be developed and supported for the IBM i platform.

7 | Zend by Perforce © Perforce Software, Inc. zend.com Zend by Perforce Offerings

8 | Zend by Perforce © Perforce Software, Inc. zend.com PHP Solutions for IBM i from Zend by Perforce

• Zend Server for IBM i • Full PHP Stack • Basic – available to "new" IBMi customers, • Enterprise-class Application Server includes 1 year of "silver" support • Three license levels (Basic, Professional, Enterprise) • Professional – subscription basis, 9x5 support • Enterprise – subscription basis, 24x7 support • Zend Server Developer Edition • Reduced-cost includes Z-Ray & other development tools

• ZendPHP1 • Supported, Full PHP Stack, without Zend Server • Professional – subscription basis, 9x5 support • Two license levels Professional, Enterprise • Enterprise – subscription basis, 24x7 support

• ZendPHP Community • Sourced from community PHP • Support via community channels or IBM TSS

• ZendDBi • MariaDB build for IBM i • Db2 Storage Engine enables data storage in Db2 for open-source applications 1Not currently available for IBM i

9 | Zend by Perforce © Perforce Software, Inc. zend.com PHP Options Fact Sheet

Zend Server ZendPHP Community PHP Support Model Support Tickets ; Support Specialist Community Based Support Term 9x5 ; 24x7 None Support Security Back Ports 5 years past community 2+ years past community None Upgrade Frequency Quarterly Monthly Extension Availability 80+ Limited (28) Extendibility Extension Installation Automatic Manual Library Management Via GUI Manual ibm_db2 Included Not available in repository Database ODBC Included RPM available pdo_ibm Included RPM available

10 | Zend by Perforce © Perforce Software, Inc. zend.com PHP Options Fact Sheet

Zend Server ZendPHP Community PHP Monitoring Included Some community Upgrade to Zend Server for Code Trace Included solutions exist but Application Server have not been Application Profiling Included functionality. ported to IBM i. Application Management Included Application Server Community Participation Limited Limited Functions Web Server Included Manual Integration/Configuration Installation Installation Wizard Installation Wizard + RPM Separate RPM installs for optional installs for each modules component

11 | Zend by Perforce © Perforce Software, Inc. zend.com Community PHP

12 | Zend by Perforce © Perforce Software, Inc. zend.com Community PHP for IBM i is Here • The PHP engine that is built and maintained by the Open Source community is now available for IBM i • NOTE: Community PHP for IBM i is maintained by the Zend by Perforce team as part of the PHP community

• Why? • This has been the subject of RFEs to IBM • Provides choice to IBM i customers • Not seen as a replacement for Zend Server but more as an alternative for those that want to "kick the tires" of PHP

• Isn't the PHP that's delivered with Zend Server "community" PHP • In a sense yes; however, the PHP that is delivered with Zend Server has been tested/certified and includes 80+ extensions that are installed/configured "out-of-the- box"

13 | Zend by Perforce © Perforce Software, Inc. zend.com Community PHP Two delivery options for PHP are available:

Community OSS PHP (RPM) Zend Server • Installed with 'yum' package • Installed as a Licensed manager Program Product (LPP) • Repository: • Purchasable support from http://repos.zend.com/ibmiphp Zend • Purchasable IBM TSS Support • Defect and security patches past community EOL (http://ibm.biz/ibmi-oss- support) • Includes extra features to aid deployment, performance, • Grow your own stack monitoring, etc. • Complete web development stack

14 | Zend by Perforce © Perforce Software, Inc. zend.com Integrated Installation vs. Grow Your Own Zend Server Community OSS PHP (RPM)

Ready to start developing / Steps could include: implementing solutions • Install PHP • Configure PHP • Create Apache instance • Configure FastCGI • Configure docroot • Configure Virtual Hosts • Build/Install ibm_db2 • Install iToolkit • Install Libraries • Install PHP Language Extensions

15 | Zend by Perforce © Perforce Software, Inc. zend.com Database Connectivity

Description Zend Server Community PHP ibm_db2 Procedural Db2 calls Provided DIY ODBC Open Database Connectivity Client Provided (details later) DIY, recommended by IBM pdo_ibm Data Abstraction layer Provided DIY

• ibm_db2 is the driver for Db2 that has been available since the initial roll-out of PHP on the platform. • This driver is leveraged by countless customer-developed as well as ISV-provided applications on the platform. • Open Database Connectivity (ODBC) is an open standard Application Programming Interface (API) for accessing a database. • IBM embracing ODBC is the standard for accessing Db2 from open source programming languages • pdo_ibm is a data abstraction layer that works with an underlying database driver such that PHP programs, from a data access perspective, start to become database agnostic.

16 | Zend by Perforce © Perforce Software, Inc. zend.com Zero to PHP – One and Done The Zend Server Approach

17 | Zend by Perforce © Perforce Software, Inc. zend.com PHP – The Zend Server Way

A key feature of Zend Server is ease of When Zend Server is installed the following is installation accomplished: Required User-Profiles are Created A Zend Server Library is created A subsystem is created for Zend Server Directory structure needed by Zend Server is created Product is installed – both Application Server and PHP 80+ Extensions are installed and configured Apache Web Server integration is configured (Apache instances added to Zend Server subsystem)

18 | Zend by Perforce © Perforce Software, Inc. zend.com One Command – 3 keys

RSTLICPGM LICPGM(7PHPZND) DEV(*SAVF) SAVF(qgpl/zendphp7)

19 | Zend by Perforce © Perforce Software, Inc. zend.com Does PHP work after install? The proof is in the scripts!!

• Place following script in the configured document root (/www/zendphp7/htdocs):

• Point a web browser at the IP address (network name) of your IBM i with virtual host 10080 (configured in Apache by the Zend Installer) followed by the name of the script just created:

http://:10080/hello.php

Output generated in web browser

Cool!! You are now ready to develop your own PHP scripts – but wait, there is so much more!!

20 | Zend by Perforce © Perforce Software, Inc. zend.com Practical PHP

What can be Done with PHP Productivity Solutions • Grow Your Own • Non IBM i Specific • SQL-based • ILE Integration • Ready Made • LAMP • CRUD

21 | Zend by Perforce © Perforce Software, Inc. zend.com The PHP Ecosystem on IBM i • PHP on IBM i continues to be a driving force in web deployments • >80% of web sites use PHP for dynamic content • PHP provides an ease of entry in both development and deployment • PHP provides excellent performance and scalability • And this improved significantly with v7 of the language • Complete Open Source Deployment Stack (IBM i, Apache, PHP, MariaDB) • Enterprise-class Open Source Applications such as WordPress, , and ZenCart deployable on IBM i without change

Augment Rapidly extend Leverage existing enterprise existing applications data to wider Enterprise- with web/php set of stake class CMS, based holders eCommerce, interfaces others

22 | Zend by Perforce © Perforce Software, Inc. zend.com PHP – The Zend Server Way - Revisited

A key feature of Zend Server is ease of When Zend Server is installed the following is installation accomplished: Required User-Profiles are Created A Zend Server Library is created A subsystem is created for Zend Server Directory structure needed by Zend Server is created Did I mention that the driver for SQL Product is installed – both Application Server and PHP 80+ Extensions are installed and configured access to Db2 (ibm_db2) as well as the Apache Web Server integration is configured (Apache toolkit for ILE Integration (iToolkit) is also instances added to Zend Server subsystem) automatically setup!!

23 | Zend by Perforce © Perforce Software, Inc. zend.com Db2 Access from PHP • Multiple ways to access Db2 from PHP on IBM i • Ibm_db2 driver/extension • ODBC

• Functions include • Connection PHP to Db2 • Accessing Db2 resident data • Error processing for Db2 call • Data meta functions (field size/precision, keys, etc) • With PHP it becomes easy to • Augment existing applications and extend reach/value of existing data • Avoid SQL injection from web-based data input • Programmatically join data from multipl RDBMS • Write a CRUD application • Write data-centric applications with 3rd party tools

24 | Zend by Perforce © Perforce Software, Inc. zend.com Database Connectivity

Description Zend Server Community PHP ibm_db2 Procedural Db2 Provided DIY calls ODBC Open Database Provided (details DIY, recommended Connectivity Client later) by IBM pdo_ibm Data Abstraction Provided DIY layer • ibm_db2 is the driver for Db2 that has been available since the initial roll-out of PHP on the platform. • This driver is leveraged by countless customer-developed as well as ISV-provided applications on the platform. • Open Database Connectivity (ODBC) is an open standard Application Programming Interface (API) for accessing a database. • IBM embracing ODBC is the standard for accessing Db2 from open-source programming languages • pdo_ibm is a data abstraction layer that works with an underlying database driver such that PHP programs, from a data access perspective, start to become database agnostic.

25 | Zend by Perforce © Perforce Software, Inc. zend.com Think access to Db2 is going to be difficult? Think again!! • Place the following script in the Document Root directory: " . print_r($firstRow, true) . ""; • Execute the script Array http://:10080/dbtest.php ( [CUST_ID] => 1221 [COMPANY] => Kauai Dive Shoppe [FIRSTNAME] => LINA [LASTNAME] => Norman [CIVIL] => 2 [ADDRESS] => 4-976 Sugarloaf Hwy Drumroll please [ADDR2] => Suite 103 [CITY] => Kapaa Kauai [STATE] => HI No intervening steps [ZIP] => 94766-1234 between Zend Server [COUNTRY] => US [PHONE] => 808-555-0269 installation and [FAX] => 808-555-0278 running of this script! )

26 | Zend by Perforce © Perforce Software, Inc. zend.com Wouldn’t it be nice to truly “Integrate” PHP with IBM i – wait for it… • Place the following script in the document root directory:

$obj = ToolkitService::getInstance();

$rows = $obj->CLInteractiveCommand('DSPLIBL'); echo '

' . print_r($rows, true) . '
'; $obj->disconnect();

• Execute the script: Array ( http:<:10080/iletest.php [0] => 5770SS1 V7R4M0 190621 Library List [1] => ASP [2] => Library Type Device Text Description [3] => QSYS SYS System Library [4] => QSYS2 SYS System Library for CPI's Again, no intervening steps [5] => QHLPSYS SYS [6] => QUSRSYS SYS System Library for Users between Zend Server installation [7] => QGPL USR General Purpose Library [8] => QTEMP USR [9] => * * * * * E N D O F L I S T I N G * * * * * and running of this script! )

27 | Zend by Perforce © Perforce Software, Inc. zend.com PHP – The Zend Server Way – Revisited 1 More Time!

A key feature of Zend Server is ease of When Zend Server is installed the following is installation accomplished: Did I mention that the driver for SQL Required User-Profiles are Created A Zend Server Library is created access to Db2 (ibm_db2) as well as the A subsystem is created for Zend Server toolkit for ILE Integration (iToolkit) is also Directory structure needed by Zend Server is created automatically setup!! Product is installed – both Application Server and PHP 80+ Extensions are installed and configured The Open Source Database (MariaDB) is Apache Web Server integration is configured (Apache also delivered (although not installed by instances added to Zend Server subsystem) default) for those who want to implement LAMP-based productivity solutions!!

28 | Zend by Perforce © Perforce Software, Inc. zend.com Is installing MariaDB difficult? Nope!

• Step 1: Use Zend Server's management menu (GO ZENDPHP7/ZSMENU) to set the desired open source database (MySQL or MariaDB) • Step 2: Use Zend Server's management menu (GO ZENDPHP7/ZSMENU) ZendDBi submenu to install MariaDB • This will perform a RSTLICPGM for the ZendDBi Licensed Program

29 | Zend by Perforce © Perforce Software, Inc. zend.com Myth: Cutting-edge LAMP applications don't run on IBM i

MySQL/MariaDB Apache PHP Full stack provided with and

configured by Zend Server Stack Deployment

Delivered as ZendDbi Single-click install and setup Becomes

LinuxIBM i

i IBM i MariaDB

30 | Zend by Perforce © Perforce Software, Inc. zend.com General Process for Installing Open Community Web Applications

• Step 1: Download the application to your PC

• Step 2: Copy the tar file (resulting from previous step) into the IFS (normally into the /www/zendphp7/htdocs directory)

• Step 3: Enter the PASE environment ssh into IBM i

• Step 4: Navigate to the directory where the uploaded file resides

31 | Zend by Perforce © Perforce Software, Inc. zend.com General Process for Installing Open Community Web Applications

• Step 5: Determine if a subdirectory needs to be created tar tvf application.zip • Step 5a: if a subdirectory is needed: mkdir // cd // • Step 6: Expand the archive file: tar xvf application.tar

• Step 7: Point a web-browser to the application setup/configuration program: http://IBMi:10080/

32 | Zend by Perforce © Perforce Software, Inc. zend.com Myth: Cutting-edge LAMP applications don't run on IBM i Layer Solution Download and Run! No Changes Needed

MySQL/MariaDB Apache PHP Full stack provided with and

configured by Zend Server Stack Deployment

Delivered as ZendDbi Single-click install and setup Becomes

LinuxIBM i

i IBM i MariaDB

33 | Zend by Perforce © Perforce Software, Inc. zend.com Other Ways to Exploit/Extend your Data à Datagrid Utilities

• If you don't want to write your CRUD type of applications from scratch you might want to check out the following:

ScoreStory

34 | Zend by Perforce © Perforce Software, Inc. zend.com phpGrid Example

display(); ?>

35 | Zend by Perforce © Perforce Software, Inc. zend.com Characteristics of the PHP Environment

36 | Zend by Perforce © Perforce Software, Inc. zend.com The Zend Subsystem

Job Description ZSDAEMON Brains! Coordinates activities of other daemons. Applies license key. If this is down there will be multiple issues ZSDEPLMNG Deployment Manager. Manages deployment of applications (may be an apache restart) and libraries (no apache restart of configuration). Manages multiple versions ZSJAVA_BRG Java Bridge – Allows PHP to invoke Java. ZSJOBQMNG Job Queue Manager. Coordinates activities in the Job Queue.

37 | Zend by Perforce © Perforce Software, Inc. zend.com Apache Jobs

• These are the jobs where the PHP module (fast-CGI) actually runs • The number of jobs is driven by the configuration in the fastcgi.conf file

38 | Zend by Perforce © Perforce Software, Inc. zend.com /www/zendphp7/conf/fastcgi.conf

Parameter Usage Default Value StartProcesses Number of "parent" processes for the PASE 1 FastCGI worker jobs. These allocate the resources for the "child" job that service the incoming requests. PHP_FCGI_CHILDREN Indicates the number of scripts/requests that 10 can be run simultaneously PHP_FCGI_MAX_REQUESTS Number of requests each worker/child job 0 will service before ending and being relaced with a new worker job ConnectionTimeOut Number of seconds before web server 30 receives time out RequestTimeout 60

39 | Zend by Perforce © Perforce Software, Inc. zend.com Managing the PHP Jobs/Environment

40 | Zend by Perforce © Perforce Software, Inc. zend.com High Level View of Management Menu (GO ZENDPHP7/ZSMENU)

Menu Description Operation Work with subsystem, jobs, and logs Apache Work with the Apache instances and configuration Daemon Management Work with the daemons, including start, stop, restart, and status Additional Products Work with MariaDB (ZendDBi) and 5250 Bridge Maintenance Work with configuration and maintenance functions

41 | Zend by Perforce © Perforce Software, Inc. zend.com • Different versions of Zend Server have been delivered as different Licensed Programs on IBM i • Licensed Program Product (LPP) is a common way to deliver software on an IBM i system. • Different versions of Zend Server also run in different subsystems than earlier versions • This enables later versions of Zend Server to run side-by-side with earlier versions

Zend PHP Licensed Subsystem Management DocRoot Program Directory Ports Server Version Program Program Version

Core 1ZCORE ZEND /www/zend/htdocs /usr/local/zend 89

5.X 2ZSVRPI ZENDSVR zendsvr/zsmenu /www/zendsvr/htdocs /usr/local/zendsvr 10088

6.x-8.x 5,6 6ZSVRPI ZENDSVR6 zendsvr6/zsmenu /www/zendsvr6/htdocs /usr/local/zendsvr6 10080 - DocRoot 10081 - WebGUI

9.X 7.x 7PHPZND ZENDPHP7 zendphp7/zsmenu /www/zendphp7/htdocs /usr/local/zendphp7 10090 – DocRoot 2018.X 10091 - WebGUI 2019.x

42 | Zend by Perforce © Perforce Software, Inc. zend.com Managing the PHP Runtime Environment - Highlights

43 | Zend by Perforce © Perforce Software, Inc. zend.com Resetting the Password

• The Web Management GUI is accessed at: http://:10081

• Forgot your password? GO ZENDPHP7/ZSMENU [option 80]

44 | Zend by Perforce © Perforce Software, Inc. zend.com Questions to Ask

• How can I react to environment and code issues • How can security be maintained? before they become critical? • Data masking, action auditing • Monitoring, events, thresholds, and actions • How can I scale my PHP environment? • How can I gain insight into my application during • Cluster Management development? • How can I ensure my PHP environment remains • Z-Ray, Code-Trace, Debug Integration, URL-insight current? • How can I manage my code base? • Automated PHP updates and patches • Application Management, Integration with popular • How can I manage PHP tasks and job-management? CI/CD tools • Job Queue • How can more performance be squeezed out of • How can 100% up-time be maintained? my environment? • Event-driven monitoring, deployment packages, CI/CD • Caching, tweaks to settings based on recurring events workflows

45 | Zend by Perforce © Perforce Software, Inc. zend.com Application Server can benefit the entire SDLC

Monitoring URL Insight IDE Integration Dashboarding Code Trace Debug Profiling

Application Monitoring Management Event Cluster Management Processing

46 | Zend by Perforce © Perforce Software, Inc. zend.com Who Cares About What

• Code Trace • Monitoring • Data Masking • Application • Dashboard Profiling • Auditing • Application • Debugging Management • Caching • Virtual Host Management • Cluster Management • Cache Management • Configuration Management • Job Scheduling

47 | Zend by Perforce © Perforce Software, Inc. zend.com The Developer Persona Without an Application Server – Grow/Invent Your Own

add_set_pprof_trace()

PECL ADP profiling IDEs debugging xdebug

PHP Environment caching code trace PageCache library xdebug Lacks reporting on effectiveness

48 | Zend by Perforce © Perforce Software, Inc. zend.com The Developer Persona With an Application Server – Put Your Nose Against the App Server – it’s in there. ;-)

add_set_pprof_trace()

PECL ADP profiling IDEs debugging Zend Debugger or xdebug PHP Environment caching code trace PageCache library xdebug Lacks reporting on effectiveness

49 | Zend by Perforce © Perforce Software, Inc. zend.com The System Manager Persona Without an Application Server – Grow/Invent Your Own

Manual *.ini file Manual web server configuration editing editing

Configuration Other Functions: Management vhost • Dashboarding configuration • Application PHP Management NAGIOS Environment (O/S Dependent) • Cluster Management Job Scheduling • Cache Management monitoring CRON (O/S Dependent)

Lacks - Good reporting - Monitoring - Re-spawn on error

50 | Zend by Perforce © Perforce Software, Inc. zend.com The System Manager Persona With an Application Server – it becomes easy!

Configuration

Management vhost

configuration PHP Environment Job Scheduling monitoring CRON (O/S Dependent)

Lacks - Good reporting - Monitoring - Re-spawn on error

51 | Zend by Perforce © Perforce Software, Inc. zend.com The Compliance Manager Persona Without an Application Server – Grow/Invent Your Own

O/S Reliant on programmer Dependent auditing & Configuratio data n Intensive programming masking practices PHP Environment

52 | Zend by Perforce © Perforce Software, Inc. zend.com The Compliance Manager Persona Without an Application Server – Rest Easy, We Have You Covered

auditing data masking PHP Environment

53 | Zend by Perforce © Perforce Software, Inc. zend.com Updates

54 | Zend by Perforce © Perforce Software, Inc. zend.com Significant Performance Gains • Performance gains a goal of every release! • Optimizations to the significantly enhances performance • Performance gains ranging from 20-70% have been seen in real-world applications • No application code changes required! • Point releases within 7.x see 5-10% performance improvements as well

55 | Zend by Perforce © Perforce Software, Inc. zend.com Real Applications Enjoy Increased Performance

These benchmarks show a roughly 2x performance gain between PHP 7.0 and PHP 5.6 using real-world application performance.

56 | Zend by Perforce © Perforce Software, Inc. zend.com Reduced Memory Footprint

Badoo estimates $1m+ and $100K/yr savings on their Application Server in part due to the memory footprint gains with version 7 of PHP

Zend Engine has improved performance with reduced memory footprint!

57 | Zend by Perforce © Perforce Software, Inc. zend.com Reduced CPU Load

Reduced CPU load achieved from further optimizations in the Zend Engine

58 | Zend by Perforce © Perforce Software, Inc. zend.com Tumblr indicates that their servers are Twice the Performance serving pages twice as fast and that they are doing it with half the amount w/Half the CPU of CPU resources.

zend.com 59 | Zend by Perforce © Perforce Software, Inc. zend.com Running a version of PHP earlier than 5.6 may put your site at risk: ü Bugs/defects Long Term Support (LTS) ü Breaks ü Security vulnerabilities

• Community PHP – Support typically ends three (3) years after release • No bug fixes • No security patches! • Zend Server's PHP – Support at least five (5) years after release – PHP applications remain secure

60 | Zend by Perforce © Perforce Software, Inc. zend.com Why Long-Term Support Matters

• Upwards of 77% of sites are running versions of PHP no longer supported by the community • Of that 77%, upwards of 66% would continue to be supported via Zend Server's PHP • Covers versions 5.6, 7.0, and 7.1 which are no longer community supported

These numbers are based on packagist/ pulls. Percentage of IBMi customers on versions of PHP not supported by community is likely higher. https://blog.packagist.com/php-versions-stats-2020-1-edition/

61 | Zend by Perforce © Perforce Software, Inc. zend.com Highly-Useful Changes Type declarations for class properties Arrow functions shorthand syntax Covariance in return and argument types Array unpacking Scalar Type Declarations Return Type Declarations Void Return Type Null Coalescing and Null Coalescing Assignment Operators Numeric literal separator for readability Spaceship Operator <=> Array Constants Exceptions in the Engine Session Options Easy Userland CSPRNG (Cryptographically Secure Pseudo-Random Number Generator) Foreign Function Interface (FFI) Group Use Declarations Time doesn't permit going into detail on Filtered unserialize() all of these – feel free to request the PHP7 Benefits of Upgrading deck.

62 | Zend by Perforce © Perforce Software, Inc. zend.com PHP 7.4 Highlights

Released: 28 November 2019

Leverage Zend Server's multi-PHP support

63 | Zend by Perforce © Perforce Software, Inc. zend.com Array Spread Operator (aka Argument Unpacking) • The spread operator (Argument Unpacking) introduced a syntax for unpacking arrays and traversables into argument lists • This is sometimes referred to as "splat operator", "scatter operator" or "spread operator"

• Compared to array_merge() • Spread operator should have better performance as the spread operator is a language construct while array_merge() is a function call. • array_merge() only supports arrays while spread operator also supports object implementing Traversable

• Version 7.4 of PHP adds this capability to array expressions $array1 = [1, 2, 3]; $array2 = [4, 5]; • The change does not introduce any backward compatibility issues. $result = [0, …$array1, …$array2, 6, 7];

// [ 0, 1, 2, 3, 4, 5, 6, 7

64 | Zend by Perforce © Perforce Software, Inc. zend.com Numeric Literal Separator

• PHP 7.4 allows the use of underscores to visually separate numeric values:

$unformattedNumber = 107925284.88;

$formattedNumber = 107_925_284.88;

• The underscore between digits does not change its value. • The underscore(s) are stripped out during the lexing stage, so the runtime is not affected.

From the RFC: The human eye is not optimized for quickly parsing long sequences of digits. Thus, a lack of visual separators makes it take longer to read and debug code and can lead to unintended mistakes.

65 | Zend by Perforce © Perforce Software, Inc. zend.com Null Coalescing Assignment Operator • The null coalescing assignment operator is a shorthand for null coalescing operators: The null-coalescing operator ?? This $data['date'] = $data['date'] ?? new DateTime(); Returns the value of its left- hand operand if it isn’t null, otherwise, it evaluates the right- Can now be done as this $data['date'] ??= new DateTime(); hand operand and returns its result. Combining null coalescing with assignment From the RFC: Combined assignment operators have been around since 1970's, appearing first in the Programming Language. For example, $x = $x + 3 can be shortened to $x += 3. With PHP being a web focused language, the ?? operator is often used to check something's existence like $username = $_GET['user'] ?? 'nobody'; However, because variable names are often much longer than $username, the use of ?? for self assignment creates repeated code, like $this->request->data['comments']['user_id'] = $this->request->data['comments']['user_id'] ?? ‘value’;. It is also intuitive to use combined assignment operator null coalesce checking for self assignment. Despite ?? coalescing operator being a comparison operator, coalesce equal or ??=operator is an assignment operator. If the left parameter is null, assigns the value of the right parameter to the left one. If the value is not null, nothing is made.

66 | Zend by Perforce © Perforce Software, Inc. zend.com Preloading

• PHP can be configured to preload scripts into the opcache when the engine starts • Any symbols (functions, classes, etc.) in those files will then become globally available for all requests without needing to be explicitly included.

• Preloading is a tradeoff between convenience/performance and baseline memory usage

The resulting performance improvement comes at a cost

If the of preloaded files are changed, the server must be restarted

https://stitcher.io/blog/preloading-in-php-74

67 | Zend by Perforce © Perforce Software, Inc. zend.com Preloading Extends the Effectiveness of OPCache

OPCache Preloading takes OpCache further

• PHP parses source code, compiles to platform- • PHP files in memory on startup and have them independent intermediate bytecode, which is then permanently available for all subsequent requests passed to Zend Engine for execution

• On web server startup, a set of PHP files is loaded, • The built in OPCache caches the bytecodes for PHP parsed, and compiled files, so they don’t have to be re“compiled” each time the file is used • Permanently-available for as long as the web server is running • Least recently-used files get removed from the cache when it’s full • Without preloading non-opcached files are loaded on every request – especially costly with frameworks

68 | Zend by Perforce © Perforce Software, Inc. zend.com Other Notable Updates

• Named Parameters è Passing arguments to a function based on the parameter name, rather than position.

// Using positional arguments: array_fill(0, 100, 50);

// Using named arguments: array_fill(start_index: 0, num: 100, value: 50);

• str_starts_with() à checks if a string begins with another string

• str_ends_with() à checks if a string ends with another string • str_contains() à checks if a string is contained in another string and returns a Boolean value whether or not the string was found

69 | Zend by Perforce © Perforce Software, Inc. zend.com Code Checkers and Fixers • Command-line tools that make migration from PHP 5.x to 7.x easier • Search code and generates reports containing file names, line numbers, and short problem descriptions

• PHPCompatibility • https://github.com/PHPCompatibility/PHPCompatibility • Compatibility "sniffs" for PHP Codesniffer • Rector • https://github.com/rectorphp/rector • Phan • https://github.com/phan/phan • Phpstan • https://github.com/phpstan/phpstan • Psalm • https://github.com/vimeo/psalm

70 | Zend by Perforce © Perforce Software, Inc. zend.com Leveraging Subsystems in IBM i • Zend Server 9 is a different Licensed Program than earlier versions of Zend Server/Platform/Core • It is not possible to simply upgrade the existing Zend Server to version 9 • Zend Server 9 runs in a different subsystem than earlier versions of Zend Server/Platform/Core • This enables version 9 of Zend Server to run side-by-side with earlier versions

Version Licensed Subsystem Management DocRoot Program Directory Ports1 Program Program

Core 1ZCORE ZEND /www/zend/htdocs /usr/local/zend 89 5.X 2ZSVRPI ZENDSVR zendsvr/zsmenu /www/zendsvr/htdocs /usr/local/zendsvr 10088

6.x-8.x 6ZSVRPI ZENDSVR6 zendsvr6/zsmenu /www/zendsvr6/htdocs /usr/local/zendsvr6 10080 - DocRoot 10081 - WebGUI 9.X 7PHPZND ZENDPHP7 zendphp7/zsmenu /www/zendphp7/htdocs /usr/local/zendphp7 10080 – DocRoot 2018.X 10081 - WebGUI 2019.x 1If a later version of Zend Server is installed on a system with a previous version of Zend Server, the port numbers will be different (typically, 10090, and 10091 are used)

71 | Zend by Perforce © Perforce Software, Inc. zend.com Zend Server 2019 • Support for PHP 7.3 • Zend Server ships a certified and secure PHP &.3 stack including a large set of tested PHP extensions and libraries • Multi PHP Version Support (7.1, 7.2, & 7.3) • Zend Server now ships with more than one version of PHP. • Enables both the selection of the version to run as well as easily switching between versions. • Improvements to Page Cache • Ease of use improvements • Rule engine modernized, more intuitive to use • Conditions can be added based on response headers • Improvements to URL Insight • Dashboard redesigned with clearer visualizations including separate Requests Per Second and Response Time measurements.

https://www.zend.com/en/products/server/whats-new

72 | Zend by Perforce © Perforce Software, Inc. zend.com Multi-PHP

73 | Zend by Perforce © Perforce Software, Inc. zend.com PHP 8

74 | Zend by Perforce © Perforce Software, Inc. zend.com Overview • Version 8.0 of PHP is the next major release of PHP • Currently expected to be released at the end of 2020

• Information provided on the upcoming slides is the current planned features • Version 8 is under active development and the features are subject to change • Keep up to date at https://wiki.php.net/rfc • 44 Implemented as of September 22, 2020 • Stringable Interface • PDO::ERRMODE_EXCEPTIO • ::class allowed on objects N as default • Static return type • Weak maps • Union types • Fatal error on incompatible • Array negative indexes method signature • Trailing comma in parm lists • Attributes • Several more...

75 | Zend by Perforce © Perforce Software, Inc. zend.com New Features • Union Types • Definition: collection of two or more types which indicates (or limits) which can be used • Advantages: • Types are enforced, mistakes caught early • Type information less likely to become outdated • Types checked during inheritance • Types available through Reflection

public function foo(Foo | Bar $input): int|float;

Parameter function called Value returned can be with can be user-defined either an int or a float type of Foo or Bar.

76 | Zend by Perforce © Perforce Software, Inc. zend.com match expression The match expression is like the case statement but has safer semantics and results in more compact code if-else case match

if ($i == 'apple') { switch ($i) { echo match ($i) { echo 'i is apple’; case 'apple’: 'apple' => 'i is apple’, } elseif ($i == 'cake') { echo 'i is apple’; 'cake' => 'i is cake’, echo 'i is cake’; break; default => 'i is pizza’, } else { case 'cake’: }; echo 'i is pizza’; echo 'i is cake’; } break; • The match expression uses strict default: comparison (===) echo 'i is pizza’; • The match expression has an implicit } break after every arm (no more fall- through defect potential) • The match expression only supports one-liner expressions. Multiple line case blocks will need to continue to use the switch statement.

77 | Zend by Perforce © Perforce Software, Inc. zend.com New Features – JIT (Just In Time Compiler) • Description: Compiles parts of PHP code at runtime such that the compiled versions can be used instead of repetitively interpreting the code at run time • Advantages: will provide performance improvements • NOTE: no accurate benchmarks to date • NOTE: JIT depends on a certain level of code-reuse before it will be enforced (see next slide) • This makes possible performance improvements for web-based applications somewhat suspect • This should; however, make for better performant PHP as a general-purpose language

78 | Zend by Perforce © Perforce Software, Inc. zend.com JIT

JIT Monitor – monitors running Running code code [typically interpreted]

Code Re- execution Yes Mark code as threshold hot reached

Replace interpreted code No with optimized code Compile as optimized code Mark code as warm

79 | Zend by Perforce © Perforce Software, Inc. zend.com Frameworks and Middleware and Mezzio

80 | Zend by Perforce © Perforce Software, Inc. zend.com Advantages of Using Frameworks • Reusable, maintainable, and well-organized code • Website scalability (depending on how well-implemented the framework is) • Separation of logic and presentation via MVC and other design patterns • Shorter development time • Frameworks offer libraries and ready-to-use components – no need to reinvent the wheel for each new project • Increased Productivity: • Once a framework is mastered, applications can be developed faster because the framework provides a structured way to approach the development project • A framework also provides pre-written common, context-specific logic such as CRUD handling, authentication logic, etc. • NOTE: common application logic is more the purview of packages solutions such as CMS, ERP, and CRM

81 | Zend by Perforce © Perforce Software, Inc. zend.com What is Laminas? • Laminas is the Linux Foundation-governed continuation of Zend Framework • To allow greater community direction of the project • To provide more diverse funding for the project • To increase visibility of the project • A differentiation from the commercial Zend brand to the Open Source project was needed – hence the birth of Laminas • Laminas Project includes a number of subprojects • Laminas API Tools (formerly Apigility) • Mezzio (formerly Expressive) • A goal of the Laminas Project is the promotion of solid PHP development practices Laminas is the plural of lamina which means thin layer. This is is fitting for the Laminas framework: • Represents components that you can compose or layer into any application • Middleware architectures are often termed layered.

82 | Zend by Perforce © Perforce Software, Inc. zend.com What happened to the existing code?

The following table represents the migration from ZF to Laminas and the corresponding repositories Original Project Original GitHub Original PHP New Project New GitHub New PHP Organization Namespace Name Organization Namespace Zend zendframework Zend Laminas laminas Laminas Framework (Components) (Components) Zend zendframework Zend Laminas (MVC) laminas Laminas Framework MVC Apigility zfcampus ZF/ZF\Apigility Laminas API Tools laminas-api- Laminas\ApiT tools ools Expressive zendframework Zend\Expressive Mezzio mezzio Mezzio

Tools available to assist with update of code to use the new classes provided by the Laminas packages. Tools available to update dependencies to use the new Laminas packages instead of the Zend Framework versions. Check-out http://docs.laminas.dev/migration/ for more information

83 | Zend by Perforce © Perforce Software, Inc. zend.com • Mezzio implements both PSR-7 (HTTP message) and PSR-17 (HTTP Mezzio - Middleware request handlers and middleware) • Provides a standard-driven middleware runtime as an alternative to the Laminas MVC • Middleware is code that executes between an incoming request and a handler, allowing for flexible, custom runtimes per HTTP endpoint • Middleware architectures are particularly suited for APIs and microservices • Mezzio targets PHP Framework Interop Group (PHP-FIG) standards for HTTP messages and middleware

84 | Zend by Perforce © Perforce Software, Inc. zend.com References • IBM Announcement • https://www-01.ibm.com/common/ssi/ShowDoc.wss?docURL=/common/ssi/rep_ca/7/897/ENUS920- 047/index.html&lang=en&request_locale=en • Perforce Announcement (Blog) • https://www.zend.com/blog/zend-perforce-announcement-ibm-i-users • Zend Server for IBM i Installation (with One Click) • https://www.zend.com/blog/zend-server-for-ibm-i-install • Where you get your PHP from Matters (Blog) • https://www.zend.com/blog/picking-right-php-ibm-i • New in PHP 8 • https://wiki.php.net/rfc#php_80 • https://stitcher.io/blog/new-in-php-8 • Laminas blog • http://zend.com/blog/evolution-zend-framework-laminas-project • Laminas Migration Tools • http://docs.laminas.dev/migration/ • Community PHP • https://www.zend.com/blog/getting-started-community-php • https://www.zend.com/blog/installing-community-php-ibm-i

85 | Zend by Perforce © Perforce Software, Inc. zend.com Free, Hands-on Training with Open Source

The Perforce team has developed a number of free hands-on exercises for you to further your exploration of Open Source based technologies

Available Exercises: • Implementing Productivity Solutions via LAMP Applications • Exploring Basic PHP Programming • Introduction to XMLService and the Toolkit • Leveraging Db2 Data via a CRUD Application • Getting Familiar with the PASE Shell Environment • Setting up an Open Source Development Environment • Introduction to Open Source Programming Languages – Node.js • Introduction to Open Source Programming Languages – Python • Overview of Shell Programming

Information/Registration: zend.com/ibm-i-training-exercises#tab-panel-12066 86 | Zend by Perforce © Perforce Software, Inc. zend.com Backup Materials – Application Server Functions make life easier!

87 | Zend by Perforce © Perforce Software, Inc. zend.com Zend Server Web GUI – Main Page

88 | Zend by Perforce © Perforce Software, Inc. zend.com Dashboard

• The Dashboard provides an overview of the health and performance of the PHP server

89 | Zend by Perforce © Perforce Software, Inc. zend.com PHP • While first two items on the Zend Server Web GUI are free-standing, the remaining items provide sub-menus of functionality • The PHP item has two sub-items • Extensions – the extensions page lists all of the extensions delivered with Zend Server or added via the php.ini file • The information presented in ‘Extensions’ is the same information as provided in the php.ini file • For IBM i environments it is recommend that the Web GUI be used to change the extensions rather than editing the ini file directly. • From the extensions page, extensions can be loaded/unloaded and directives for the extensions can be set or modified. • phpinfo() • Runs the phpinfo() function and displays it's output which includes version and extensions information

90 | Zend by Perforce © Perforce Software, Inc. zend.com PHP Extensions

Force all connections to be persistent

Control support for anonymous connection

91 | Zend by Perforce © Perforce Software, Inc. zend.com PHP – phpinfo() • phpinfo() causes the phpinfo() function to be called and provides an output of the results • The information provided by phpinfo() includes the current state of the server and php environment

This information can also be displayed by running phpinfo() from a php script.

92 | Zend by Perforce © Perforce Software, Inc. zend.com Applications

• The applications portion of the Zend Server Web GUI provides a number of sub-functions for working with PHP-based applications: • Manage Apps • Virtual Hosts • Libraries • Settings

93 | Zend by Perforce © Perforce Software, Inc. zend.com Applications – Manage Applications

• The Manage Apps portion of Applications provides the ability to view and manage deployed applications on the server as well as deploy new applications and define new applications. • NOTE: In a clustered environment applications can be deployed to multiple nodes in the cluster at the same time. • NOTE: The ability to define new applications is as simple as pointing to a lading page for the application. This is important as once an application as been ‘defined’ it is available for monitoring.

94 | Zend by Perforce © Perforce Software, Inc. zend.com Applications – Manage Applications – Application Deployment • Deploying an application involves: • Copying application files • Configuration • Enabling the application to a specific base URL • The flow of the process is:

95 | Zend by Perforce © Perforce Software, Inc. zend.com Applications – Manage Applications – Deploy Application • Deployment of applications to either a single server or cluster of servers can be controlled/defined via a ZPK package format. • The ZPK file is a zip binary with a number of artifacts including • Package files • Composer binary for installation of dependencies • Deployment XML file • Application name • version.release • Appdir – project root directory • Docroot – directory from which the vhost will serve files

Building of deployment packages is initiated wi the 'zdpack' utility which is located in the /usr/local/zendphp7/bin directory.

96 | Zend by Perforce © Perforce Software, Inc. zend.com Applications – Manage Applications – Deploy Application

• Deployment can be initiated via

• The first step is to provide the path for the ZPK file:

• After the ZPK has been successfully uploaded select

If a readme was specified in the ZPK it is displayed

97 | Zend by Perforce © Perforce Software, Inc. zend.com Applications – Manage Applications – Deploy Application • By default applications are deployed with either the default virtual host (10080 unless multiple versions of Zend Server are installed) • Applications can also be deployed against newly defined virtual servers • Defining a new virtual server is accomplished by select the button next to 'Virtual Host'

Add New

NOTE: Review the value in the 'URL' box that gets built as the other fields of the dialog are completed to ensure it reflects the correct URL/path.

98 | Zend by Perforce © Perforce Software, Inc. zend.com Applications – Manage Applications – Deploy Application

• Provide the top-level directory for the application files to reside

• Once the dialog is complete select Any license agreement provided in the ZPK is displayed and most be agreed to

99 | Zend by Perforce © Perforce Software, Inc. zend.com Applications – Manage Applications – Deploy Application

Any prerequisites defined in the ZPK are checked and the results of the check are displayed

NOTE: Any unresolved prerequisites must be satisfied before the deployment wizard can proceed.

100 | Zend by Perforce © Perforce Software, Inc. zend.com Deploy Application Wizard

101 | Zend by Perforce © Perforce Software, Inc. zend.com Application Management Dashboard

U r p e d m a o t v e e

r r e e d n p a l m o e y

102 | Zend by Perforce © Perforce Software, Inc. zend.com Applications – Manage Applications – Deploy Application: Virtual Host Definition # Created by Zend Server Listen *:10030 The 'listen' directive has to be manually added

DocumentRoot "/usr/local/zendphp7/var/apps/http/10.68.240.200/10030/_docroot_" Options +Indexes +FollowSymLinks DirectoryIndex index.php Order allow,deny Allow from all AllowOverride All

ServerName 10.68.240.200:10030

# include the folder containing the vhost aliases for zend server deployment Include "/usr/local/zendphp7/etc/sites.d/http/10.68.240.200/10030/*.conf"

• If a new virtual host was defined as part of the application deployment then a new virtual host configuration file is created in the /usr/local/zendphp7/etc/sites.d directory • The name of the file will contain the ip address and port number (ex: vhost_http_10.68.240.200_10030.conf)

103 | Zend by Perforce © Perforce Software, Inc. zend.com Applications – Manage Applications – Define Application • Existing applications can be integrated into the Zend Server management UI via

• This allows functions such as monitoring and event reporting to be more granular (i.e., application level rather than server level)

• Once defined the application will be displayed on the Manage Apps page and can be monitored like any deployed application within the Zend Server environment.

104 | Zend by Perforce © Perforce Software, Inc. zend.com Applications – Virtual Hosts

• 'Virtual Hosts' is used to work with virtual hosts for the Apache Web Server. • The interface allows for defining new virtual hosts as well as working with existing virtual hosts. • NOTE: The basic edition of Zend Server only allows for the creation of virtual hosts – no management functions are supported

105 | Zend by Perforce © Perforce Software, Inc. zend.com Applications - Libraries

• Libraries provide additional functionality – examples include frameworks and the PHP Toolkit for IBM i (XMLService wrapper) • The Libraries function is used to deploy, manage, and update development framework libraries on Zend Server.

106 | Zend by Perforce © Perforce Software, Inc. zend.com Applications - Settings

• The settings page allows for configuration of behavior and policies related to application deployment.

107 | Zend by Perforce © Perforce Software, Inc. zend.com Monitoring

• A number of monitoring related functions are available in the monitoring area of the Zend Server management UI including:

Function Description URL Insight Used to view detailed reports and information on specific requests for PHP pages located on the web server Events Displays events encountered/detected by Zend Server. An event is a collection of runtime-related information collected by the Monitor component. Events are triggered based on the monitoring rules. Event Rules Used to display and generate the Event rules that trigger events. Logs Provides a way to display system log information from within the Zend Server UI Settings

108 | Zend by Perforce © Perforce Software, Inc. zend.com Monitoring – Monitor Events

• The 'Monitor Events' page shows all of the events that have been raised by the PHP engine (such as errors in scripts run, slow request execution, high memory usage, etc)

109 | Zend by Perforce © Perforce Software, Inc. zend.com Monitoring – Event Rules

• Event rules can be defined at both the overall PHP level as well as individual application level • Applications become "known" to Zend Server either through a deployment action or a define action. • Different applications can have different monitoring The event rule page thresholds and provides for the definition corresponding actions of event thresholds and defined. actions

110 | Zend by Perforce © Perforce Software, Inc. zend.com Z-Ray

• Z_Ray can be thought of as an application profiler on steroids • It provides real-time insight into application performance, code insight, request information, etc.

Function Description Z-Ray Live! Provides the ability to monitor another users web session that has been enabled (via modeàselective) Z-Ray History Saved Z-ray sessions can be interrogated Mode Allows switching between enable, disabled, and selective.

You can take z-ray out for a test drive at è https://www.zend.com/en/products/server/z-ray-use-cases

111 | Zend by Perforce © Perforce Software, Inc. zend.com Z-Ray Mode

Development mode

Production mode

112 | Zend by Perforce © Perforce Software, Inc. zend.com Z-Ray Example

113 | Zend by Perforce © Perforce Software, Inc. zend.com Z-Ray Example

114 | Zend by Perforce © Perforce Software, Inc. zend.com Z-Ray Example

115 | Zend by Perforce © Perforce Software, Inc. zend.com Z-Ray Example

116 | Zend by Perforce © Perforce Software, Inc. zend.com Z-Ray in Action – A Real-World IBM i Example

• Imagine the following scenario: • Customer has implemented the open source moodle application • Moodle is a Learning Platform or Course Management System (CMS) • When the customer updated to the latest version of Moodle they were seeing significant performance issues (frankly, the application was unusable) • See Next Slides for how using Z-Ray quickly identified the issue:

117 | Zend by Perforce © Perforce Software, Inc. zend.com Z-Ray in Action – A Real-World IBM i Example

• Step 1: Enable Z-Ray in selective mode for the application • Step 2: From a Web Browser, make a request to the moodle URL • Step 3: When the Z-Ray tool-bar is displayed review the execution time information:

34.72 ms 78% 128.64 ms 21% 2.10 ms 1% 0.00 ms ~0%

118 | Zend by Perforce © Perforce Software, Inc. zend.com Z-Ray in Action – A Real-World IBM i Example • Step 4: Review Database Queries:

– Step 4a: Sort on the 'Time' field to bring the longest running database statement to the top • Sort showed that the longest running SQL statement was the database connection statement – Investigation of that issue showed A DNS issue within the customer's environment

The use of Z-Ray identified the issue within a matter of minutes – the customer had previously spent days trying to isolate the issue!!

119 | Zend by Perforce © Perforce Software, Inc. zend.com Code Tracing

120 | Zend by Perforce © Perforce Software, Inc. zend.com Job Queue

• The Job Queue provides the ability to define and schedule jobs to be run at specific days/times – Recuring jobs are supported – PHP-CLI as well as O/S scripts are supported

Use cases would include items such as background credit card and order processing The API interface could be used to schedule jobs as well.

121 | Zend by Perforce © Perforce Software, Inc. zend.com Run-time Performance

122 | Zend by Perforce © Perforce Software, Inc. zend.com Caching

• Three types in PHP: • OpCache: Improves PHP performance by storing precompiled script bytecode in – this reduces the need for the PHP engine to parse scripts on each request. • Data Cache: Improves PHP performance by storing data in a cache • Page Cache: Improves PHP performance by caching the PHP output (HTML) for identified URLs on first execution.

A cache is a collection of duplicate data where the original data is expensive to fetch or compute relative to the cache.

123 | Zend by Perforce © Perforce Software, Inc. zend.com Cache - OPcache • OPcache has a number of functions for working with and managing the cache. • Two functions of particular note: • opcache_compile_file à This function can be used to compile a PHP script without executing it. A typical usage of this function is to prime the cache after a web server restart • opcache_is_script_cached à This function returns an indication as to whether a script is cached or not. Typically used to detect the warming of the cache for a particular script

More information on the OPCache functions ccan be found on php.net

http://php.net/manual/en/ref.opcache.php

124 | Zend by Perforce © Perforce Software, Inc. zend.com Data Cache • Data Cache is a component of Zend Server that provides a set of PHP functions to improve performance. • Different data types can be stored in the cache including strings, arrays, and objects. • Items can be stored in shared memory or disk • Cached objects can be grouped together in namespaces.

• Data Cache is typically used when it is impractical to cache the entire page (see page caching) • One example would be a form that includes credit card numbers, social security numbers, and other personal privileged information (PPI) that you don't want stored in a cache

Information on working with the data cache can be found at: http://files.zend.com/help/Zend-Server/content/working_with_the_data_cache.htm

125 | Zend by Perforce © Perforce Software, Inc. zend.com Page Cache • Page Cache is a component of Zend Server and is used to improve application performance by caching the entire output of a PHP script • It is important to note that Page Cache does not mitigate the dynamic capability of a PHP generated page – the dynamic capability is maintained through a rules system. • Use of Page Cache does not require any change to the underlying PHP code.

• As a best practice, pages should be cached when their content is stable and does not require frequent changes. More information on page cache can be found at: http://files.zend.com/help/Zend- Server/content/page_cache_concept.htm?Highlight=page%20cache

126 | Zend by Perforce © Perforce Software, Inc. zend.com Page Cache - Results

A number of factors will affect the effectiveness of the cache including number of page request, frequency of data updates on the page, cache life, etc.

127 | Zend by Perforce © Perforce Software, Inc. zend.com 128 | Zend by Perforce © Perforce Software, Inc. zend.com