If you are having difficulty executing programs with the Toolkit (getting a MSWG on the IBM i) you can turn on the Toolkit Debug Log to help track down the error. This can be done either in your code or in the toolkit.ini file. No restart required! Once debug is ‘on’ you will reply to the MSGW and be able to inspect the log file.

In the toolkit.ini located in /usr/local/zendsvr6/share/ToolkitAPI

debug = true;
debugLogFile = "/usr/local/zendsvr6/var/log/user_toolkit_debug.log"

In your code where you create the toolkit connection:

$logName = '/usr/local/zendsvr6/var/log/user_toolkit_debug.log';
$conn->setOptions(array(
                       'debug'     => true,
                       'debugLogFile' => $logName,
));

If you omit the debugLogFile and it will go to /usr/local/zendsvr6/var/log/debug.log. Putting a specific name will allow multiple users to have debug logs when calling different jobs.