Issue

After ending the ZENDPHP7 Apache instance (or ZENDSVR6 for Zend Server versions 6 - 8.5.x or ZENDSVR for Zend Server version 5), the Apache instance cannot be restarted.  Looking in the QHTTPSVR subsystem, there are one or more jobs named ZENDPHP7 active with the function 'PGM-php-cgi.bi' running.  An example scenario would be a back up routine that ends the ZENDPHP7 Apache instance for the duration of the back up, then fails to start the ZENDPHP7 Apache instance after the back up completes.

Environment

Any version of Zend Server running on any supported version of IBM i.

Please Note:  For Zend Server 6 - 8.5.x , use ZENDSVR6 instead of ZENDPHP7 and for Zend Server 5, use ZENDSVR instead of ZENDPHP7.

Resolution

This procedure uses an example utility called ENDUSRJOB.  You can find it here:

End jobs on the IBM i by User and Job Name – ENDUSRJOB

You could also write your own utility to perform a similar function.  The principles discussed here would still apply.

Consider a batch job that does a back up. During the back up, the ZENDPHP7 Apache instance should not be running. After the back up, if there are any left over ZENDPHP7 batch jobs still running, it will not be possible to start the ZENDPHP7 Apache instance.

Here is how you might use a utility like ENDUSRJOB to help insure there are no leftover jobs.

In your batch program, you could use a command like this to end Zend Server:

ADDLIBLE ZENDPHP7
CALL ZENDPHP7/ZENDSBS

This should end the ZENDPHP7 subsystem, and also end the ZENDPHP7 Apache instance. Then you could wait a couple of minutes for a normal shutdown to complete:

DLYJOB DLY(120) 

Then, shut down any remaining ZENDPHP7 Apache jobs with the *IMMED option:

ENDUSRJOB USER(QTMHHTTP) JOBTYPE(*BATCH) JOBNAME(ZENDPHP7) OPTION(*IMMED)

This will issue an ENDJOB *IMMED for any ZENDPHP7 Apache job still running.

Proceed with the back up.

After the back up, restart the ZENDPHP7 subsystem and Apache instance:

ADDLIBLE ZENDPHP7
CALL ZENDPHP7/ZSTRSBS

If the jobs will not end in a reasonable amount of time even when the ENDJOB *IMMED is tried, you can try using ENDJOBABN, by using the OPTION(*ABN) parameter. The ENDJOBABN command cannot be run for a job until at least 10 minutes after the job has gone into end immediate status, which happens when you do an ENDJOB *IMMED, or the wait time expires on an ENDJOB *CNTRLD. So you could do something like this:

ENDUSRJOB USER(QTMHHTTP) JOBTYPE(*BATCH) JOBNAME(ZENDPHP7) OPTION(*IMMED)
DLYJOB DLY(600)
ENDUSRJOB USER(QTMHHTTP) JOBTYPE(*BATCH) JOBNAME(ZENDPHP7) OPTION(*ABN)

Instead of doing the 10 minute delay job, you could possibly proceed with the back up (if the back up is while active), then do the ENDJOBABN after, assuming the back up takes at least 10 minutes.