Community PHP Is Open for Business Alan Seiden
Total Page:16
File Type:pdf, Size:1020Kb
Community PHP is Open for Business Alan Seiden Alan Seiden Principal, Seiden Group Mentors CIOs & development teams Deliver modern technical solutions Open Source Advocate Co-developer of PHP Toolkit for IBM i Founder of Club Seiden community Host/Sponsor, CIO Summit Open Source Experts Develop web/mobile apps Support PHP, including CommunityPlus+ Train developers: open source & IBM i PHP APIs Git Node.js Db2 Python seidengroup.com About Seiden Group Seiden Group • Modernization using open source on the IBM i platform • Top speakers and thought leaders • Develop applications for busy IT departments • User-friendly, efficient, graphical and feature-rich designs Seiden Group Thought Leaders w “IBM i Fresh Faces” interview video 2017 Recognition by IBM w Alan Seiden: IBM Champion w Stephanie Rabbani: IBM Champion, “Fresh Face of IBM i” w Liam Allan: IBM Champion, “Fresh Face” w Calvin Buckley: Innovation award winner, “Fresh Face” w Several innovation awards w Other leaders and industry speakers…largest concentration of PHP on IBM i experts… Rob Allen… George Colon… Recent projects w Saskatchewan Blue Cross w Consumer insurance application w Business from applications doubled w Allied Beverage Group w Modernized “green screen” e-commerce into web/mobile system used by sales reps, customers. Flexible for new needs w Mill Steel w Mobile app using live data from core system International partnership https://www.cscweb.jp/ w cu We are official ibm_db2 maintainers w cu Why PHP? Web apps and APIs w PHP: bringing web applications to IBM i since 2005-6 w Award-winning applications across all industries w Access your Db2 data, RPG code, and more w PHP Toolkit helped compatibility and integration w Web services and APIs w First taste of calling external APIs from IBM i w Credit card payments… Salesforce… many more w Converting green screens to web Use PHP from RPG, CL w PHP can be called from CL and RPG too! w Software development kits (SDKs) often written in PHP w Control flow from traditional RPG w Use PHP power to access APIs, payment gateways, create spreadsheets, graphics Wordpress and content management w Community and conference sites w Wordpress.. beyond blogs.. Star Wars site, more! PHP on IBM i timeline w 2004 Alan needed PHP on “i5”! w i5php.net—Rob Ward’s site w 2006 Zend Core—IBM shipped in its DVDs w Zend Platform paid add-on w 2008-9 Zend Server w No-cost OSS + admin pages + paid add-ons bundled w Basic / Professional / Enterprise licenses w 2019 RPM-based open PHP begun w Includes ODBC again, now in 64 bits PHP in 2020-21: What’s NEW w PHP is going “Open” with industry-standard RPM format, 64-bit, installable with YUM w Initiated by IBM and Zend in 2019 w Seiden CommunityPlus+ in 2020 w Zend Server “Basic” license withdrawn by June 2021 w Professional/Enterprise still available for purchase w Open PHP (e.g. CommunityPlus+) fills the gap More about CommunityPlus+ PHP w Quick to install and upgrade w Lightweight—but has what you need w Db2 connectivity: w Choice of ibm_db2, PDO_ODBC, PDO_IBM, and odbc w Supports all the PHP frameworks w Laminas (formerly Zend Framework) w Laravel, others w Support available w “These PHP RPMs make my heart happy. This PHP is similar to what I’m used to in Linux.”—young developer PHP and MySQL • PHP and MySQL are foundations of WordPress and many internet sites • MariaDB is a good substitute for MySQL • These run on most platforms, including IBM i Good news for MySQL users • In TR3/TR9, IBM will deliver MariaDB (drop-in replacement for MySQL) via Yum • See announcement here: • https://www.ibm.com/support/pages/ibm-i-73-tr9- enhancements GRAR case study w Public site based on WordPress on IBM i that calls RPG stored procedures w http://www.grar.com/ GRAR uses WP for portal • WP provides marketing site, themes, good look • Custom PHP code included in key pages Custom PHP used by GRAR • Security/access to pages • Calling RPG stored procedures for heavy logic • Live demo (if time) IBM’s Open Source Commitment Open source was in IBM’s plan w IBM i Chief Architect Steve Will offers strategic direction to CIO Summit guests in 2018 IBM built framework for open source w Over the last few years, faster and better! w Yum command for easy installation w RPM package manager w https://en.wikipedia.org/wiki/RPM_Package_Manager w Access Client Solutions to manage with a GUI Why RPM your PHP? Quick installation w Minutes instead of hours w No FTP’ing, unzipping, SAVFs w Industry-standard Yum command w Same as other current IBM i open source w Standard IBM /QOpenSys/pkgs location w Quick upgrades w yum update w Gain even more speed by automating / scripting the installation w Customization for your country/user base is possible Flexible installation w Choose or w Existing Apache and FastCGI configs still work! w Multiple web server instances for different workloads w Test in parallel with existing Zend Server w Install multiple versions via chroot More bits = more data without errors w RPM PHP is 64-bit, while previous PHP was 32-bit w What does that mean? w More memory, no more memory dump errors w Good-bye, “LDR_CNTRL” memory hack! This has what you want in PHP w PHP 7.4 and counting w Some community PHP repos were missing some of the extensions that were bundled in Zend Server….“We rebuild them!” w Seiden Group maintains “missing” modules w 64-bit Ibm_db2, Ldap, Zip, Imagick, ssh2, intl w mail() with standard sendmail Also, CommunityPlus+… w Installs PHP Toolkit w Provides digitally signed RPMs (security) w Sets optimized .ini settings for IBM i CommunityPlus+ Compatibility w Compatible with other PHP distributions w Migration generally quick if you are on modern PHP versions w Use yum to update and install from CommunityPlus+ or others w We use all standard, open source components. Nothing proprietary w Gives you options (no lock-in) Ready for Business Business-Ready Open Source w Seiden CommunityPlus+ packages: w Digitally signed for security w https://www.seidengroup.com/2020/07/23/rpm-package-signing/ w Updated frequently, along with PHP’s own schedule w Available in multiple modern versions (7.3 and 7.4 today) w Supported by Seiden Group’s PHP experts w Quick, accurate advice and fixes Support w “Seiden Group support is amazing!” — Yoshiki Ushida (we fixed ibm_db2 for Japanese) w “We’re doing great with Laravel and PHP RPM’s. Reaching out to you was definitely the right choice.” — Jim Lomonaco, Co-operative Feed Dealers w “These IBM i RPMs make my heart happy. They are more similar to what I’m used to on Linux.” — Young-ish developer PHP 7 and CommunityPlus+ Performance Benchmarks PHP 7 Faster than PHP 5.x w Spurred by competition with Facebook’s “Hack” w Noticeable speedup on large sites—pages “pop” Upgrading from PHP 5.6 to PHP 7 w New features in 7.x: w https://www.php.net/manual/en/migration70.new-features.php w Your code should “just work” with a few exceptions w https://www.seidengroup.com/2017/07/24/resources-for- upgrading-to-php-7-on-ibm-i/ w Old MySQL code using the mysql_* functions should be updated to mysqli_* (“IMySQL Improved”) or PDO w Old regular expression syntax “ereg()” was removed w RPM upgrade to PHP 7: uses path /QOpenSys/pkgs/bin/php PHP 7.4 w Faster than PHP 7.3 out of the box w A good step toward PHP 8.0 w Also an opcache improvement w Opcache.preload w opcache_compile_file($path) pre-compiles scripts w “Warms up” the opcache upon web server restart w Try it with large frameworks w https://wiki.php.net/rfc/preload w Language updates: w https://www.php.net/releases/7_4_0.php PHP 8.0 w WHEN: w Coming soon w WHAT: w Just In Time (JIT) compiler w Execute compiled code directly on hardware rather than in VM w May help CPU-bound applications w Expect modest performance improvements w https://thephp.website/en/issue/php-8-jit/ Benchmark performance test https://github.com/vanilla-php/benchmark-php Performance results (first pass) With all extensions turned off, for apples-to-apples comparison Note: real-world results can always differ from synthetic benchmarks Let’s Install PHP! Install PHP using Yum and ACS w Download CommunityPlus+ PHP w https://www.seidengroup.com/communityplus-php-for-ibm-i/ w We recommend SSH to get into PASE w STRTCPSVR *SSHD w Industry-standard: younger developers will thank you (install the bash shell for them!) w Open source PASE-based software works best in SSH ACS Open Source Package Management w IBM i SSH server service must be running on port 22 Open Source Package Management (ACS) w Log in with a QSECOFR or *ALLOBJ level user Open Source Package Management w You may receive these prompts. Just say Yes ! Open Source Package Management w All is working if you see a list of packages ! Install PHP using Yum (continued) w The yum command: w yum install “php-*” w TIP: Your user profile must have *ALLOBJ to install via Yum w Set up Apache web server w CommunityPlus+ has a utility to set up a new Apache server automatically w You can create more than one! Dev/test/production w Runs in parallel with Zend Server for easy testing w Or reuse existing PHP Apache instances Configuration tips FastCGI configuration w FastCGI prestarts PHP jobs for fast web sites w Minimal contents of fastcgi.conf (in /www/myserver/conf/): w Server type="application/x-httpd-php" CommandLine="/QOpenSys/pkgs/bin/php-cgi" StartProcesses="1” w IpcDir /www/myweb/logs w Additional/optional keys: w How many PHP jobs to start w SetEnv="PHP_FCGI_CHILDREN=20" w How long to wait before a 408 timeout w RequestTimeout="60" Nginx alternative to Apache w nginx web server w Flexible alternative