Issue

After deploying a newer version of the PHP Toolkit for IBM i library, and making the newer version the default, scripts continue to run version 1.5.0 of the Toolkit.

Environment

Zend Server for IBM i version 6 - 8.5.x, that has been upgraded from version 6.1.0 or earlier, running on any supported version of IBM i.

Resolution

The PHP Toolkit was installed in older versions of Zend Server in this directory:

/usr/local/zendsvr6/share/ToolkitApi

In newer versions, this directory was made a symlink to the default library directory for the PHP Toolkit:

/usr/local/zendsvr6/var/libraries/PHP_Toolkit_for_IBMI_i/default/library

Zend Deployment will place whichever version is specified as the default into this directory.  This allows the default version to be changed in the Zend Server User Interface.  If the old directory is not symlinked to the new directory, then changes to the default version may not be honored in your code, if the include_path still has the old directory.

Here is how to tell if you have this issue:

Step 1) From the command entry line in a 5250 session, logged in as QSECOFR or a user with *SECOFR special authority:

call qp2term

This brings up the PASE shell.  First use this command to verify that the new default library exists:

ls /usr/local/zendsvr6/var/libraries/PHP_Toolkit_for_IBMI_i/default

If you don't have the default library, the output will look like this:

ls: 0653-341 The file /usr/local/zendsvr6/var/libraries/PHP_Toolkit_for_IBMI_i/default does not exist.

If that is the case, you do not need to continue with this article.

However, if the output looks something like this:

LICENSE.txt  library      logo.png

Then please keep working.

Step 2) Next, see if the old directory is a symlink to the new default directory.  Use this command:

ls -l /usr/local/zendsvr6/share/ToolkitApi

If it is a symlink to the new directory, your output will be similar to this:

lrwxrwxrwx    1 qsecofr  0               144 Sep 15 13:49 /usr/local/zendsvr6/share/ToolkitApi -> /usr/local/zendsvr6/var/librari
es/PHP_Toolkit_for_IBMI_i/default/library

If the old directory is a symlink to the new default directory, then you are all set.  You can stop here.  However, if your output looks more like this:

total 656 
drwxr-srwx 2 qsecofr 0 8192 Mar 24 2014 CW
-rwxrwxrwx 1 qsecofr 0 5460 Mar 18 2013 Db2supp.php
-rwxrwxrwx 1 qsecofr 0 3764 Mar 18 2013 Odbcsupp.php
-rwxrwxrwx 1 qsecofr 0 76430 Mar 21 2013 ToolkitService.php
-rwxrwxrwx 1 qsecofr 0 18367 Mar 18 2013 ToolkitServiceParameter.php
-rwxrwxrwx 1 qsecofr 0 451 Mar 21 2013 ToolkitServiceSet.php
-rwxrwxrwx 1 qsecofr 0 39723 Mar 18 2013 ToolkitServiceXML.php
-rwxrwxrwx 1 qsecofr 0 4464 Mar 19 2013 httpsupp.php
-rwxrwxrwx 1 qsecofr 0 54606 Mar 20 2013 iToolkitService.php
-rwxrwxrwx 1 qsecofr 0 5249 Mar 21 2013 toolkit.ini

then you do not have the directory symlinked correctly.  Please continue with the steps to fix the issue.

Step 3) Stop Apache.  This will make your web site unavailable, so please schedule this activity for a suitable time.  You can stop the ZENDSVR6 instance of Apache using this CL command:

endtcpsvr *http httpsvr(zendsvr6)

Step 4) Rename the /usr/local/zendsvr6/share/ToolkitApi directory using the mv command, to save it.  In the PASE shell:

mv /usr/local/zendsvr6/share/ToolkitApi /usr/local/zendsvr6/share/ToolkitApi.sav

Step 5) Create the symlink.  In the PASE shell:

ln -s /usr/local/zendsvr6/var/libraries/PHP_Toolkit_for_IBMI_i/default /usr/local/zendsvr6/share/ToolkitApi

Step 6)  If any changes had been made to the toolkit.ini file, you will need to make those same changes to the toolkit.ini file in /usr/local/zendsvr6/var/libraries/PHP_Toolkit_for_IBMI_i/default if you want them to remain in effect.  You can use the copy of toolkit.ini in the saved copy of the original directory (see Step 4) as a guide.  Be aware that any time you change the default version of the library, you will need to redo this step.  Please keep a record of change made to toolkit.ini.

Step 7) Start Apache.  You can start the ZENDSVR6 instance of Apache using this CL command:

strtcpsvr *http httpsvr(zendsvr6)

Optional step) After changing the old library directory to be a symlink to the default library directory, you can remove the old library directory from the default PHP include path.  To insure backward compatibility, both the new default directory and the old directory are included in the php include_path setting in installations that have been updated from older versions.  You can check for this in the Zend Server User Interface, and change it there as well.  Navigate to the Overview -> Server Info tab.  Using your browser search (usually accessed via ctrl-F or F3), search for 'include_path'.  Check to see if the include_path has both the default library and the old library in the path:

.:/usr/local/zendsvr6/var/libraries/Zend_Framework_1/default/library
:/usr/local/zendsvr6/share/pear
:/usr/local/zendsvr6/var/libraries/PHP_Toolkit_for_IBMI_i/default/library
:/usr/local/zendsvr6/share/ToolkitApi

Notice that in this example, both the new path (/usr/local/zendsvr6/var/libraries/PHP_Toolkit_for_IBMI_i/default/library) and the old path (/usr/local/zendsvr6/share/ToolkitApi) are in the include_path.  You can remove the old path.  Navigate to the Configurations -> PHP tab.  This tab shows a list of extensions and other configurable parts of PHP.  Find 'Paths and Directories' on the list, and click it to expand the list of directives.  Find 'include_path' on the list.  Click in the text entry for include_path to position your cursor.  Use the right arrow key to move the cursor all the way out to the end of the entry.  You cannot see the whole entry, so this part requires taking some care.  Make sure your cursor is positioned at the end of the /usr/local/zendsvr6/share/ToolkitApi path, and then use the back key to delete it one character at a time.  Also delete the colon that preceded the directory.  DON'T GO TOO FAR.  You just want to remove this one directory and the colon that precedes it.  After making the change, click the Save button in the upper left.  

Restart Apache for the change to take effect.