Issue

When trying to access an Oracle table in PHP running on Zend Server for IBM i, the PHP program fails with following error: undefined function OCILogon()  

Environment

Starting with Zend Server 2021.1.0 the Oracle oci8 Extension can be added using yum install.  This extension is not available in Zend Server 2020.x and Zend Server 2021.0, as there was no available 64-bit version from Oracle at that time. 

Resolution

The Open Source Environment for IBM i must be configured prior to running this command

https://ibmicommunity.thebeardedgeek.com/2020/07/setting-up-the-open-source-environment-on-ibm-i/

Make sure you are logged in with a *SECOFR class user profile. Your user profile should have a home directory containing a .profile file, and that .profile file should set your path so the yum command can be found.

If you are not sure your user profile is properly set up, please review Preparing for Installation

To begin the update, go into the PASE terminal. From the 5250 command line:

call qp2term

In the PASE terminal, enter this command.

yum install php-oci8-zend-server

The system will resolve dependencies and calculate the download size.  Key 'y' to continue the install.

 

                                                   /QOpenSys/usr/bin/-sh                  
                                                                                            
 Dependencies Resolved                                                                      
                                                                                            
 ================================================================================           
  Package                   Arch       Version            Repository        Size            
 ================================================================================           
 Installing:                                                                                
  php-oci8-zend-server      ppc64      2021.1.2-2         zend_server      562 k            
 Installing for dependencies:                                                               
  liboci-zend               ppc64      10.2-25            zend_server       40 M            
                                                                                            
 Transaction Summary                                                                        
 ================================================================================           
 Install       2 Packages                                                                   
                                                                                            
 Total download size: 40 M                                                                  
 Installed size: 123 M                                                                      
 Is this ok [y/N]:                                                                          
                                                                                            
==> y                

Messages similar to the ones below will appear as the installation proceeds.  While the update is running, do not enter additional commands or exit the screen. Allow the process to run until a dollar sign (or hashtag for QSECOFR) appears. This indicates the process has completed.                    

 --------------------------------------------------------------------------------      
 Total                                            20 MB/s |  40 MB     00:02           
 Running Transaction Check                                                             
 Running Transaction Test                                                              
 Transaction Test Succeeded                                                            
 Running Transaction                                                                   
   Installing : liboci-zend-10.2-25.ppc64                                    1/2       
   Installing : php-oci8-zend-server-2021.1.2-2.ppc64                        2/2       
                                                                                       
 Installed:                                                                            
   php-oci8-zend-server.ppc64 0:2021.1.2-2                                             
                                                                                       
 Dependency Installed:                                                                 
   liboci-zend.ppc64 0:10.2-25                                                         
                                                                                       
 Complete!                                                                             
 $          

The zsd daemon needs to be restarted after the extension has been added. 

/usr/local/zendphp74/bin/zsd.sh restart 

This command submits a job to the jobqueue on the IBM i.

/usr/local/zendphp74/bin/zsd.sh restart                                                       
CPC1221: Job 082836/QTMHHTTP/ZSDAEMON submitted to job queue ZSVR_JOBQ in library ZENDPHP74.              

Once the submitted job has completed, log into the Zend Server User Interface, typically at port 10101 for Zend Server 2021.1.x

Navigate to the PHP tab and click on Extensions.  The oci8 extension will be 'off' by default.  Select the extension by clicking the check box and then click the 'Enable' button at the top left of the window. 

                                   

Before the extension can be 'loaded' and functional, a Restart of Zend Server is required.  There should be an orange circular arrow in the upper right of the window indicating the need for a Restart.

Please note that the Restart will require that your website / applications will be down for a few minutes while the changes are applied and the server jobs restarted.                                        

After pressing the orange arrow for the Restart the following Confirmation screen will appear.  Press Yes if you are ready to Restart Zend Server.  If you decide not to restart at this time, press No to Cancel the request. 

When the Restart has completed, the Extension will be 'Loaded'.  Clicking it once displays the details of the messages and use of the extension.